This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// decreases request count on rapid-fire one model saves | |
// extended backbone.js sync function. uses setTimeout to batch multiple saves on one model in one http request. | |
// if client side needs immediate answer from server for changes in model attributes, | |
// pass { immediate: true } in model save options if { wait: true } is not used already. | |
Backbone._sync=Backbone.sync | |
Backbone.sync = function(method, model, options){ | |
var maxResetCount=5 // how many times to delay save | |
var saveBufferSize=3000 // for how many microseconds save is delayed | |
var immediate=options['wait'] || options['immediate'] || false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Here's a little CoffeeScript routine that will recursively | |
# read the file-system, generating an object that represents | |
# a directory tree. | |
# The returned object will contain the following attributes: | |
# | |
# * `file` - the basename of the file. | |
# * `dir` - the directory containing the file. | |
# * `types` - an array containing zero or more of | |
# "File", "Directory", "SymbolicLink", "BlockDevice", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# powerpoint-to-pdf <PPT-FILE> [<PDF-FILE>] | |
# Uses <https://documentalchemy.com/> to convert a PowerPoint document to PDF. | |
# SET YOUR DOCUMENT ALCHEMY API KEY HERE (OR PASS AS AN ENV VAR). | |
# SIGN UP AT <https://documentalchemy.com/> TO GET YOUR FREE API KEY. | |
DA_API_KEY=${DA_API_KEY:-"EDs2UQEprGn9aD4vg6HCPhFvgQFDahQgRzzIfocJ"} | |
# PRINT USAGE MESSAGE | |
show_help() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#------------------------------------------------------------------------------- | |
# draw-histogram - generates an ASCII-art histogram (bar chart) from input data. | |
#------------------------------------------------------------------------------- | |
# Expects a series of lines of the form `<category-name> <count>` to passed | |
# via stdin. | |
# | |
# Generates a table the looks something like the following: | |
# | |
# +-------+----+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Uses a PID file to add daemon-like behavior to an arbitrary program. | |
################################################################################ | |
usage() { | |
echo "Usage: `basename $0` PROGRAM {start|stop|restart|force-stop|force-restart|status} [PIDFILE|PID]" >&2 | |
echo "Where: PROGRAM is an executable file." >&2 | |
echo " PIDFILE is the file that contains (or will contain) the PID." >&2 | |
echo " PID is a process id to use in place of a PIDFILE." >&2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new context. | |
Local<Context> context = Context::New(isolate); | |
// Enter the context for compiling and running the hello world script. | |
Context::Scope context_scope(context); | |
// Create a string containing the JavaScript source code. | |
Local<String> source = String::NewFromUtf8(isolate, "'Hello' + ', World!'"); | |
// Compile the source code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A quick little thingy that takes a Stream instance and makes | |
* it emit 'line' events when a newline is encountered. | |
* | |
* Usage: | |
* ‾‾‾‾‾ | |
* emitLines(process.stdin) | |
* process.stdin.resume() | |
* process.stdin.setEncoding('utf8') | |
* process.stdin.on('line', function (line) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Flipping tables! (╯°□°)╯︵ ┻━┻" | |
num_rules=3 | |
real=3 # exposed to the ELB as port 443 | |
test=4 # used to install test certs for domain verification | |
health=5 # used by the ELB healthcheck | |
blue_prefix=855 | |
green_prefix=866 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install s3fs on Mac OS X | |
1 - Install Homebrew - http://brew.sh/ | |
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
2 - Use Homebrew to install s3fs + dependencies | |
brew install s3fs | |
3 - Do some custom stuff. I only used the first step from here -> https://gist.github.com/fukayatsu/3910097 | |
sudo /bin/cp -rfX /usr/local/Cellar/fuse4x-kext/0.9.2/Library/Extensions/fuse4x.kext /Library/Extensions |
OlderNewer