Skip to content

Instantly share code, notes, and snippets.

ryanray / lodash-4-migrate
Created May 31, 2016 17:35
Simple script that finds all files with lodash 3.x method calls within a given directory so you can upgrade them to lodash 4.x
View lodash-4-migrate
# Use to find methods that were renamed in lodash 4.
# Ex: `./ src/` to find files that contain any of the lodash 3.x names in the src/ directory.
# supporting the _.chain() methods such as .min() can produce false positives such as Math.min(). See line ~151.
usage() {
echo "wrong number of arguments"
echo "Usage: $0 directory_to_search"
if [ "$#" -lt 1 ]
ryanray / aws-api-gateway-form-to-json.ftl
Created October 4, 2015 01:24
API Gateway application/www-form-urlencoded to application/json based on
View aws-api-gateway-form-to-json.ftl
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))
ryanray / deploy.rb
Created November 21, 2013 11:15
I couldn't find a quick example of how to deploy a node.js app using Capistrano 3. This gist assumes you are using Capistrano 3, Upstart, Forever, ssh/forward agent, and an unprivileged user named 'deploy'. Hopefully this simple setup will help to get you started.
View deploy.rb
# config/deploy.rb
# probably a lot of ways to improve this...
set :application, 'my_app'
set :repo_url, ''
# should set up a deploy user
set :user, 'deploy'
set :deploy_to, '/var/www/my_app'
set :scm, :git
ryanray / deploy.rb
Created November 21, 2013 05:32 — forked from alkema/deploy.rb
View deploy.rb
set :application, "appname"
set :deploy_to, "/var/www"
set :scm, :git
set :repository, ""
default_run_options[:pty] = true
set :user, "www-data"
set :domain, "foo.tld"
set :normalize_asset_timestamps, false