Skip to content

Instantly share code, notes, and snippets.

@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:

@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 / alphabetical_numerical_sort.js
Created February 2, 2017 22:53
Sort Array Alphabetically and Numerically
var reA = /[^a-zA-Z]/g;
var reN = /[^0-9]/g;
function sortAlphaNum(a, b) {
var aA = a.replace(reA, "");
var bA = b.replace(reA, "");
if (aA === bA) {
var aN = parseInt(a.replace(reN, ""), 10);
var bN = parseInt(b.replace(reN, ""), 10);
return aN === bN ? 0 : aN > bN ? 1 : -1;
@aaronice
aaronice / update_github_pull_request.md
Last active May 11, 2018 17:51
How to update a pull request

How to update a pull request

Example: (use develop as base branch, upstream is original repo, origin is my own fork repo)

Switch local branch

git checkout develop

Get latest changes from upstream:

git pull -r upstream develop

@aaronice
aaronice / learn_erlang.md
Created February 16, 2017 23:29
Erlang Notes
@aaronice
aaronice / smart-dark-mode.css
Created January 11, 2018 01:18
CSS for Custom Smart Dark Mode
/*
Parts of this code is inspired from the following:
[1] https://userstyles.org/styles/105000/smart-dark
*/
html {
background-color: #222 !important;
}
body {
@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 / proc_msg_example.erl
Last active June 7, 2018 21:04
Erlang Process Example
launch() ->
register(echo, spawn(demo, echo, [])).
echo() ->
receive
{Pid, Msg} ->
Pid ! Msg,
echo()
end.
@aaronice
aaronice / css_typography.md
Last active June 8, 2018 22:16
CSS Typography

Web-safe Fonts and Font Family

Serif and Sans Serif Typefaces

  • Serif typefaces - small decorative lines;
  • Sans serif typefaces - no decorative lines;

Script and Decorative Typefaces

  • Script typefaces - hand-lettered look;
@aaronice
aaronice / custom.css
Created August 1, 2018 00:58
Custom CSS for Dark Mode Chrome Extension
/*
Parts of this code is inspired from the following:
[1] https://userstyles.org/styles/105000/smart-dark
*/
html {
background-color: #222 !important;
}
body {