One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
import binascii | |
import struct | |
class Punk(object): | |
_END_CHUNK_TYPE = 'IEND' | |
_PUNK_CHUNK_TYPE = 'puNk' | |
_MAX_BYTES = 2147483647 | |
_chunks = dict() |
function mapValues(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
result[key] = fn(obj[key], key); | |
return result; | |
}, {}); | |
} | |
function pick(obj, fn) { | |
return Object.keys(obj).reduce((result, key) => { | |
if (fn(obj[key])) { |
#!/bin/bash | |
if [ "$GIT_SSH_KEY" != "" ]; then | |
echo "Cleaning up SSH config" >&1 | |
echo "" >&1 | |
# Now that npm has finished running, | |
# we shouldn't need the ssh key/config anymore. | |
# Remove the files that we created. | |
rm -f ~/.ssh/config | |
rm -f ~/.ssh/deploy_key |
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
zeus: echo "Spawining Zeus..." && zeus start &> /dev/null | |
resque1: sleep 2 && zeus rake resque:work RAILS_ENV=development COUNT=1 QUEUE=* | |
resque2: sleep 2 && zeus rake resque:work RAILS_ENV=development COUNT=1 QUEUE=* | |
resque3: sleep 2 && zeus rake resque:work RAILS_ENV=development COUNT=1 QUEUE=* | |
web: sleep 2 && zeus server |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
module VineHasher | |
VINE_KEY = 'BuzaW7ZmKAqbhMOei5J1nvr6gXHwdpDjITtFUPxQ20E9VY3Ll' | |
VINE_KEY_SIZE = VINE_KEY.size | |
VINE_KEY_HASH = VINE_KEY.split('').each_with_index.inject({}) {|hash, (key, index)| hash[key] = index; hash } | |
def unhash_id(hashed_id) | |
hashed_id.reverse.split('').each_with_index.inject(0) { |total, (key, index)| total + VINE_KEY_HASH[key] * VINE_KEY_SIZE**index } | |
end | |
def hash_id(id) |
// Sometimes you care about the order in which RequireJS-loaded modules | |
// are retrieved, and wish to execute a callback for each module in the | |
// order in which you originally specified them, rather than the order | |
// in which they are loaded. You can do this with a queue. | |
var Queue = function() { | |
var q, | |
callCount = 0; | |