Skip to content

Instantly share code, notes, and snippets.

@aaronice
aaronice / fibonacci_closure.go
Created April 10, 2019 00:18 — forked from tetsuok/fibonacci_closure.go
An answer of the exercise: Fibonacci closure on a tour of Go
package main
import "fmt"
// Very naive answer.
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n := 0
a := 0
@aaronice
aaronice / ip.js
Created March 5, 2018 19:19 — forked from szalishchuk/ip.js
Get local external ip address with nodejs
var
// Local ip address that we're trying to calculate
address
// Provides a few basic operating-system related utility functions (built-in)
,os = require('os')
// Network interfaces
,ifaces = os.networkInterfaces();
// Iterate over interfaces ...
@aaronice
aaronice / bb.js
Created April 30, 2016 02:28 — forked from stephantabor/bb.js
Bluebird .each vs .mapSeries vs .map
var Promise = require('bluebird');
var funcs = Promise.resolve([500, 100, 400, 200].map((n) => makeWait(n)));
funcs
.each(iterator) // logs: 500, 100, 400, 200
.then(console.log) // logs: [ [Function], [Function], [Function], [Function] ]
funcs
.mapSeries(iterator) // logs: 500, 100, 400, 200
@aaronice
aaronice / API.md
Last active August 29, 2015 14:10 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: