-
Locate the path to the interpreter for the language you are writing in with the
which
command.which node which python which bash which ruby
-
Add that path as an interpreter directive (using
#!
) on the first line of your script. For example if you want to write a node script andwhich node
returned/usr/local/bin/node
, the first line of your script should be:
There are many tutorials and articles available online which explain functional programming. Examples show small functions, which are composed into others which again get composed. It is hard to imagine how it would all work, then come the analogies and then the math. While the math is necessary to understand it can be difficult to grasp initially. The analogies on the other hand, (at least for me) are not relatable. Some articles assume the reader knows the different terminologies of FP. Over all I felt it is not inviting to learn.
This introduction is for those who have had a tough time understanding those analogies, taken the plunge to functional programming but still have not been able to swim. This is yet another tutorial on functional programming
Functions are first class means they are just like anyone else, or rather they are not special, they behave the same as say primitives or strings or objects.
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
function xyz_to_ρ (x, y, z) { | |
return Math.sqrt((x * x) + (y * y) + (z * z)); | |
} | |
function zρ_to_θ (z, ρ) { | |
return Math.acos(z / ρ); | |
} | |
function yx_to_φ (y, x) { | |
return Math.atan(y / x); |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
class EventEmitter { | |
constructor() { | |
this.events = {}; | |
} | |
on(event, func) { | |
if(this.events[event]) { | |
this.events[event].push(func); | |
} else { | |
this.events[event] = [func]; |
GeoJSON is a widely-used format for encoding geographic data. It's flexible and human-readable, and because it's just JSON it's easy to integrate into web applications.
But it has some real warts, and if we wanted to we could certainly come up with a better format. After tweeting about my frustrations, I was asked to elaborate. Here goes:
GeoJSON geometries can be one of seven types: Point
, MultiPoint
, LineString
, MultiLineString
, Polygon
, MultiPolygon
and GeometryCollection
.
<?php | |
$index = $_GET['data']; | |
//accessing database | |
$database = Array ( | |
"SP500"=>2128.19, | |
"DOW"=>18150.44, | |
"NASDAQ"=>5194.41 |
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |