Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
var Promise = function(wrappedFn, wrappedThis) {
this.then = function(wrappedFn, wrappedThis) {
this.next = new Promise(wrappedFn, wrappedThis);
return this.next;
};
this.run = function() {
wrappedFn.promise = this;
wrappedFn.apply(wrappedThis);
};
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 30, 2024 04:42
A badass list of frontend development resources I collected over time.
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Geraint
Geraint / README.md
Last active September 29, 2017 00:07
Installing SASS/Compass on Windows via Cygwin

Install Cygwin & Ruby

Follow the instructions at http://cygwin.com/install.html. You will run an executable called setup.exe which will guide you through the installation. You will eventually arrive at a screen where you can select the packages you want to install. Be sure to install Ruby (its under Interpreters/ruby).

Once Cygwin has finished installing packages, it will offer to create icons for you. You can click on these icons to start up a terminal session, so select what ever is convenient for you.

Once installation is complete, start a terminal session.

Confirm that ruby is installed by typing this at the prompt:

@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@unscriptable
unscriptable / tiny Promise.js
Created February 7, 2011 06:02
A minimalist implementation of a javascript promise
// (c) copyright unscriptable.com / John Hann
// License MIT
// For more robust promises, see https://github.com/briancavalier/when.js.
function Promise () {
this._thens = [];
}
Promise.prototype = {