Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Ray ryanray

View GitHub Profile
@ryanray
ryanray / lodash-4-migrate
Created May 31, 2016
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. https://github.com/lodash/lodash/wiki/Deprecations
# Ex: `./lodash-4-migrate.sh 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 ]
then
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
ryanray / deploy.rb
Created Nov 21, 2013
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, 'git@github.com:USERNAME/my_app.git'
# should set up a deploy user
set :user, 'deploy'
set :deploy_to, '/var/www/my_app'
set :scm, :git
View deploy.rb
set :application, "appname"
set :deploy_to, "/var/www"
set :scm, :git
set :repository, "git@github.com:user/app.git"
default_run_options[:pty] = true
set :user, "www-data"
set :domain, "foo.tld"
set :normalize_asset_timestamps, false
You can’t perform that action at this time.