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
#! /usr/bin/env ruby | |
# | |
# ruby upload.rb user pass user/repo file '(description)' | |
# | |
require 'json' | |
if ARGV.size < 4 | |
puts "\nUSAGE: upload.rb [user] [pass] [user/repo] [filepath] ('description')" | |
exit |
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
# sh get_token.sh user pass | |
curl -s -d '{"scopes":["repo"],"note":"admin script"}' -u "$1:$2" -XPOST https://api.github.com/authorizations | grep token |
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 OR REPLACE FUNCTION escape_json (text) RETURNS text AS $$ | |
SELECT replace($1, '''', '\'''); $$ LANGUAGE SQL IMMUTABLE; | |
CREATE OR REPLACE FUNCTION to_json(text) RETURNS text AS $$ | |
SELECT escape_json($1) $$ LANGUAGE SQL IMMUTABLE; | |
CREATE OR REPLACE FUNCTION to_json(KEY text, value text) RETURNS text AS $$ | |
SELECT '''' || to_json($1) || ''': ''' || to_json($2) || ''''; $$ LANGUAGE SQL IMMUTABLE; |
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
desc "convert a latin1 database with utf8 data into proper utf8" | |
task :convert_to_utf8 => :environment do | |
puts Time.now | |
dryrun = ENV['DOIT'] != '1' | |
conn = ActiveRecord::Base.connection | |
if dryrun | |
def conn.run_sql(sql) | |
puts(sql) | |
end | |
else |
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
cd <PROJECT> | |
git remote add upstream [email protected]:<GITHUB_ACCOUNT_NAME>/<PROJECT>.git | |
git fetch upstream | |
#Stash/commit all your work | |
git checkout develop | |
git merge upstream/develop | |
git checkout <FEATURE_BRANCH> | |
git merge develop | |
#Fix errors, merge conflicts, etc. | |
#Run tests |
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
#!/usr/bin/env ruby | |
# Usage: gitio URL [CODE] | |
# | |
# Turns a github.com URL | |
# into a git.io URL | |
# | |
# Copies the git.io URL to your clipboard. | |
url = ARGV[0] | |
code = ARGV[1] |
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
# vmc update is great for test and development, however it stops your old app and stages and starts the new one, | |
# resulting in dropped requests. | |
# If you want to update an application without dropping user requests, see below. | |
# NOTE: This change assumes your application can share services, etc with the new version. | |
# Assume my app is named foo | |
vmc push foo-v2 --url foov2.cloudfoundry.com |
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
def explain! | |
puts 'Want to embed this Gist?' | |
puts 'Use this: <script src="http://gist.github.com/2059.js"></script>' | |
end | |
explain! |