const compose = (...fns) =>
fns.reduceRight((prevFn, nextFn) =>
(...args) => nextFn(prevFn(...args)),
value => value
);| // 🔥 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 | |
| }); | |
| } |
| [ | |
| { | |
| "name": "Alberta", | |
| "abbreviation": "AB" | |
| }, | |
| { | |
| "name": "British Columbia", | |
| "abbreviation": "BC" | |
| }, | |
| { |
npm scriptsare low-level and leverage the actual library you want to use (example:"lint": "eslint ./")package.jsonis a central place to see what scripts are available (alsonpm runwill list all scripts)- When things get too complicated you can always defer to another file (example:
"complex-script": "babel-node tools/complex-script.js") npm scriptsare more powerful than one might first think (pre/post hooks, passing arguments, config variables, chaining, piping, etc...)
Here’s how to make animations like this one. It requires intermediate Unix command-line knowledge, to install some tools and to debug if they don’t work. You’ll need these utilities:
curl(or you can translate towget)convertandmontage, part of ImageMagickffmpeg, plus whatever codecsparallel, for iteration that’s nicer than shell for loops orxargs- run everything in
zshfor leading 0s in numerical ranges to work
On mac:
- Download the latest release.
- Extract the binary and place it in
/usr/local/bin.
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com, example2.com, and example1.com/images on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
This is what we did to setup a few dashboards at platanus
- Raspberry Pi
- Dashing Service
- Wifi stick (optional)
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
| #!/usr/bin/ruby | |
| # SIFTTTER 1.5: An IFTTT-to-Day One Logger by Craig Eley 2014 <http://craigeley.com> | |
| # Based on tp-dailylog.rb by Brett Terpstra 2012 <http://brettterpstra.com> | |
| # Multiple Date Function by Paul Hayes 2014 <http://paulrhayes.com> | |
| # | |
| # Notes: | |
| # * Uses `mdfind` to locate a specific folder of IFTTT-generated text files changed in the last day | |
| # * The location of your folder should be hardcoded in line 67, and the location of your Day One in line 66 | |
| # * Scans leading timestamps in each line matching the selected dates | |
| # * Does not alter text files in any way |