Monday, August 10, 2020

Profit Per Employee: The tech companies making the most profit per employee

All companies, whether large or small, have many different ways of measuring their success, though many primarily look at profit and revenue. To get an even better idea of which businesses are really getting the most out of their resources, Tipalti has taken a look at which of the world’s...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Web Desk via Digital Information World

Are World Leaders in Business and Politics Getting Enough Sleep? (infographic)

“A problem difficult at night is resolved in the morning after the committee of sleep has worked on it.” — John Steinbeck Some of the most powerful and influential people on the planet might benefit from taking a leaf out of Steinbeck’s book. Although it is generally recommended that adults should...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World

Build a Terminal Weather App in Deno

Build a Terminal Weather App in Deno

If you’ve been following along with our introductory articles on Deno, you’re probably interested in having a go at writing your first program. In this article, we’re going to walk through installing the Deno runtime, and creating a command-line weather program that will take a city name as an argument and return the weather forecast for the next 24 hours.

To write code for Deno, I’d highly recommend Visual Studio Code with the official Deno plugin. To make things a little more interesting, we’re going to be writing the app in TypeScript.

Installing Deno

Firstly, let’s get Deno installed locally so we can begin writing our script. The process is straightforward, as there are installer scripts for all three major operating systems.

Windows

On windows, you can install Deno from PowerShell:

iwr https://deno.land/x/install/install.ps1 -useb | iex

Linux

From the Linux terminal, you can use the following command:

curl -fsSL https://deno.land/x/install/install.sh |  sh

macOS

On a Mac, Deno can be installed with Brew:

brew install deno

After installing

Once the install process is finished, you can check that Deno has been correctly installed by running the following command:

deno --version

You should now see something similar to this:

deno 1.2.0
v8 8.5.216
typescript 3.9.2

Let’s create a folder for our new project (inside your home folder, or wherever you like to keep your coding projects) and add an index.ts file:

mkdir weather-app
cd weather-app
code index.ts

Note: as I mentioned above, I’m using VS Code for this tutorial. If you’re using a different editor, replace the last line above.

Getting User Input

Our program is going to retrieve the weather forecast for a given city, so we’ll need to accept the city name as an argument when the program is run. Arguments supplied to a Deno script are available as Deno.args. Let’s log this variable out to the console to see how it works:

console.log(Deno.args);

Now run the script, with the following command:

deno run index.ts --city London

You should see the following output:

[ "--city", "London" ]

Although we could parse this argument array ourselves, Deno’s standard library includes a module called flags that will take care of this for us. To use it, all we have to do is add an import statement to the top of our file:

import { parse } from  "https://deno.land/std@0.61.0/flags/mod.ts";

Note: the examples in the docs for standard library modules will give you an unversioned URL (such as https://deno.land/std/flags/mod.ts), which will always point to the latest version of the code. It’s good practice to specify a version in your imports, to ensure your program isn’t broken by future updates.*

Let’s use the imported function to parse the arguments array into something more useful:

const args = parse(Deno.args);

We’ll also change the script to log out our new args variable, to see what that looks like. So now your code should look like this:

import { parse } from  "https://deno.land/std@0.61.0/flags/mod.ts";

const args = parse(Deno.args);

console.log(args);

Now, if you run the script with the same argument as before, you should see the following output:

Download https://deno.land/std@0.61.0/flags/mod.ts
Download https://deno.land/std@0.61.0/_util/assert.ts
Check file:///home/njacques/code/weather-app/index.ts
{ _: [], city: "London" }

Whenever Deno runs a script, it checks for new import statements. Any remotely hosted imports are downloaded, compiled, and cached for future use. The parse function has provided us with an object, which has a city property containing our input.

Note: if you need to re-download the imports for a script for any reason, you can run deno cache --reload index.ts.

We should also add a check for the city argument, and quit the program with an error message if it’s not supplied:

if (args.city === undefined) {
    console.error("No city supplied");
    Deno.exit();
}

Continue reading Build a Terminal Weather App in Deno on SitePoint.


by Nilson Jacques via SitePoint

This Page Can Show You All of Your Ignored Reports to Google

Google has always been very open to feedback from the various users that utilize the range of services that it ends up providing, and a big part of the reason why that is the case has to do with the fact that the tech giant needs to be open to such suggestions so that the people that actually use...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Zia Muhammad via Digital Information World

Hover Effect Style 276

The post Hover Effect Style 276 appeared first on Best jQuery.


by Admin via Best jQuery

Pricing Table Style 159

The post Pricing Table Style 159 appeared first on Best jQuery.


by Admin via Best jQuery

At Home

At Home
At Home is an effort to document this unprecedented moment in time; it's a collection of stories from people around the world, designed to help connect, empathize & support each other.
by via Awwwards - Sites of the day