Skip to content

Instantly share code, notes, and snippets.

View JangoSteve's full-sized avatar

Steve Schwartz JangoSteve

View GitHub Profile
@JangoSteve
JangoSteve / bundle.sh
Created November 2, 2011 05:09
bundle aliases for bash profile - ~/.bash_profile_includes/bundle.sh
alias be="bundle exec"
alias bi="bundle install"
alias bu="bundle update"
@JangoSteve
JangoSteve / git.sh
Created November 2, 2011 05:08
git aliases for bash profile - ~/.bash_profile_includes/git.sh
alias gco="git checkout"
alias gst="git status"
alias gcm="git commit -m"
alias gca="git commit --amend"
alias gpr="git pull --rebase"
alias gpl="git pull"
alias gpu="git push"
alias gri="git rebase -i"
alias gre="git rebase"
alias gad="git add"
@JangoSteve
JangoSteve / soloistrc
Created November 1, 2011 15:25
Mac Setup - soloistrc
cookbook_paths:
- /Users/steveschwartz/workspace
recipes:
- pivotal_workstation::bash_profile-arch_flags # ONLY USE IF YOU ARE ON SNOW LEOPARD
- pivotal_workstation::meta_osx_base
- pivotal_workstation::meta_osx_development
- pivotal_workstation::meta_ruby_development
- pivotal_workstation::mongodb
- pivotal_workstation::pg_admin
- pivotal_workstation::solr
@JangoSteve
JangoSteve / Terminal Saved Output.txt
Created November 1, 2011 15:23
Mac Setup - pivotal_workspace soloist - Terminal Output
Last login: Tue Nov 1 04:20:56 on console
steves-macbook:~ steveschwartz$ cd ~/workspace/
steves-macbook:workspace steveschwartz$ soloist
running chef: sudo bash -c 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin chef-solo -j /var/folders/f9/f99vsO5cHRCsJ+7Fb+UNhE+++TI/-Tmp-/soloist20111101-253-1kys0lq-0 -c /var/folders/f9/f99vsO5cHRCsJ+7Fb+UNhE+++TI/-Tmp-/soloist20111101-253-1r2g8qc-0 -l info'
Password:
[Tue, 01 Nov 2011 05:02:33 -0400] INFO: *** Chef 0.10.4 ***
[Tue, 01 Nov 2011 05:02:37 -0400] INFO: Setting the run_list to ["pivotal_workstation::bash_profile-arch_flags", "pivotal_workstation::meta_osx_base", "pivotal_workstation::meta_osx_development", "pivotal_workstation::meta_ruby_development", "pivotal_workstation::mongodb", "pivotal_workstation::pg_admin", "pivotal_workstation::solr", "pivotal_workstation::ssl_certificate"] from JSON
[Tue, 01 Nov 2011 05:02:37 -0400] INFO: Run List is [recipe[pivotal_workstation::bash_profile-arch_flags], recipe[pivotal_workstation::meta_osx_base], re
@JangoSteve
JangoSteve / ubuntu_rails_install.rb
Created January 22, 2011 17:58
Capistrano script to install Ruby, RVM, Rails in ubuntu (modified from deploy.rb scripts)
namespace :ubuntu do
desc "Setup Environment"
task :setup_env, :roles => :app do
update_apt_get
install_dev_tools
install_git
install_subversion
install_sqlite3
# Install and setup RVM instead of old Rails stack
#install_rails_stack
@JangoSteve
JangoSteve / thread_safe_block_depth.rb
Created October 25, 2010 21:29
A way to track the current block level for instance block-methods, which is completely thread-safe
class MyObject
def block_depth=(value)
Thread.current[:block_depth] = value
end
def block_depth
Thread.current[:block_depth] || 0
end
# Validates whether the value of the specified attribute matches the format of an URL,
# as defined by RFC 2396. See URI#parse for more information on URI decompositon and parsing.
#
# This method doesn't validate the existence of the domain, nor it validates the domain itself.
#
# Allowed values include http://foo.bar, http://www.foo.bar and even http://foo.
# Please note that http://foo is a valid URL, as well http://localhost.
# It's up to you to extend the validation with additional constraints.
#
# class Site < ActiveRecord::Base
#!/usr/bin/env ruby
require 'open-uri'
require 'rexml/document'
require 'rexml/xpath'
url = 'http://rpm.newrelic.com/accounts.xml?include=application_health'
headers = {'x-license-key' => 'YOUR LICENSE KEY'}
#!/bin/sh
echo "js-zipped-served-from-rmsr-vs-cloudfront-vs-intercepted-cloudfront"
echo " "
echo "------------------------------------------------------------------------------------------------------------------------------------------------------"
for i in {1..5}
do
for loc in "http://cdn.ratemystudentrental.com/javascripts/all-rmsr.js?1275522132" "http://cdn0.ratemystudentrental.com/javascripts/all-rmsr.js?1275522132" "http://compressed.ratemystudentrental.com/javascripts/all-rmsr.js?1275522132" "http://cdn0.ratemystudentrental.com/javascripts/all-rmsr.js.gz?1275522132"
do
echo "vv $loc vv"
Steves-Macbook:desktop steveschwartz$ wget http://cdn.ratemystudentrental.com/javascripts/all-rmsr.js.gz?1275522132--00:33:42-- http://cdn.ratemystudentrental.com/javascripts/all-rmsr.js.gz?1275522132 => `all-rmsr.js.gz?1275522132.6'Resolving cdn.ratemystudentrental.com... 208.78.103.49
Connecting to cdn.ratemystudentrental.com[208.78.103.49]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85,785 [application/x-gzip]
100%[====================================================================================>] 85,785 431.60K/s in 0.19 seconds
00:33:43 (429.56 KB/s) - `all-rmsr.js.gz?1275522132.6' saved [85785/85785]
Steves-Macbook:desktop steveschwartz$ wget http://cdn0.ratemystudentrental.com/javascripts/all-rmsr.js.gz?1275522132--00:33:57-- http://cdn0.ratemystudentrental.com/javascripts/all-rmsr.js.gz?1275522132 => `all-rmsr.js.gz?1275522132.7'Resolving cdn0.ratemystudentrental.com... 216.137.33.166, 216.137.33.33, 216.137.33.228, ...