Skip to content

Instantly share code, notes, and snippets.

View brianleroux's full-sized avatar
💚
You are now aware that you are breathing

Brian LeRoux brianleroux

💚
You are now aware that you are breathing
View GitHub Profile
@kristoferjoseph
kristoferjoseph / factor.sh
Created August 9, 2016 05:11
factor-bundle script for generating a common.js file from a directory of files
browserify ./screens/*.js -p [ factor-bundle -o 'tee > bundle/`basename $FILE`' ] -o bundle/common.js
@bendc
bendc / immutable.js
Created January 6, 2016 16:56
Deep freeze objects
const immutable = (() => {
const getValue = obj => key => obj[key];
const isObject = obj => Object(obj) === obj;
const isMutable = obj => isObject(obj) && !Object.isFrozen(obj);
return obj => {
Object.keys(obj).map(getValue(obj)).filter(isMutable).forEach(immutable);
return Object.freeze(obj);
};
})();
@tlrobinson
tlrobinson / post-receive
Last active December 7, 2022 08:15
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@DamonOehlman
DamonOehlman / npmd-all-the-things
Last active December 28, 2015 04:38
In preparation for potentially having no net access for a while, I'm using @dominictarr's [npmd](https://github.com/dominictarr/npmd) to bring modules I need (or potentially might use down locally). I'm sure the script can use some improvements, but it works well enough for me know.Basically, head into a parent directory somewhere where you have…
#!/usr/bin/env bash
getopts ":r:" RECURSE
for dir in *; do
if [ -d "${dir}" ]; then
pushd "$dir" > /dev/null
if [ -e package.json ]; then
echo "reinstalling packages with npmd for: ${dir}"
rm -rf node_modules
@jordwalke
jordwalke / gist:6350319
Last active September 10, 2016 16:27
ReactJS: JavaScript just like you've always done it.
/**
* ReactJS: JavaScript like you've always done it.
*
* This example renders your top ten most followed friends/followers, `filter`ing
* only your favorites, and putting a star on all verified accounts.
*
* With ReactJS, any time your data changes, the UI is always brought up to date
* automatically. If friends length changes, or followCount - it always shows what
* `render` describes.
*/
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@jeffgca
jeffgca / node_shebang.js
Last active December 11, 2015 10:59
My current node.js boilerplate
#!/usr/bin/env node
var util = require('util'),
fs = require('fs'),
path = require('path'),
mysql = require('mysql'),
moment = require('moment-range'),
async = require('async'),
csv = require('csv'),
YAML = require('libyaml'),
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@pmuellr
pmuellr / ApacheCon-cities.txt
Created February 21, 2012 23:27
list of ApacheCon cities
ApacheCon NA 2011 - Vancouver
ApacheCon NA 2010 - Atlanta
ApacheCon US 2009 - Oakland
ApacheCon EU 2009 - Amsterdam
ApacheCon US 2008 - New Orleans
ApacheCon EU 2008 - Amsterdam
ApacheCon US 2007 - Atlanta
ApacheCon EU 2007 - Amsterdam
ApacheCon US 2006 - Austin
ApacheCon AP 2006 - Colombo, Sri Lanka