Skip to content

Instantly share code, notes, and snippets.

View theill's full-sized avatar

Peter Theill theill

View GitHub Profile
namespace :app do
namespace :db do
desc "Copy entire database into current environment"
task :load => :environment do
db_config = ActiveRecord::Base.configurations[RAILS_ENV]
case RAILS_ENV
when 'development'
db_config_source = ActiveRecord::Base.configurations[DEVELOPMENT_SOURCE]
sh %{ssh -l deploy -C #{STAGING_DOMAIN} mysqldump -u #{db_config_source['username']} --password=#{db_config_source['password']} #{db_config_source['database']} | mysql -u #{db_config['username']} --password=#{db_config['password']} #{db_config['database']}}
get disk usage for all subdirectories
du -hs *
@theill
theill / gist:78025
Created March 12, 2009 11:23
In case you are not a shell wiz you may switch to Ruby to execute simple tasks e.g. unpacking a number of zip files
ruby -e "1999.upto(2009) do |year| 1.upto(4) do |no| cmd = \"unzip #{year}_#{no}.zip -d #{year}_#{no}\"; system cmd; end; end"
@theill
theill / gist:104333
Created April 30, 2009 08:03
Theills bash profile
export PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export APPENGINE_JAVA_SDK="/Users/theill/appengine-java-sdk-1.2.0"
export TERM="xterm-color"
export CLICOLOR=1
export LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=
@theill
theill / gist:716648
Created November 26, 2010 12:29
xcode tips
% defaults write com.apple.Xcode XCShowUndoPastSaveWarning NO
% defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{"ORGANIZATIONNAME" = "Commanigy"; }
welcome!
<input type="text" x-webkit-speech />
<style type="text/css" media="screen">
#pit-handbook {}
#pit-handbook ol {
margin: 0;
padding: 0;
releases_path=/data/sites/yoursite.com/releases # change this
keep_releases=5
versions=`ls -xt $releases_path`
releases=(${versions// / })
# check available number of versions in releases directory
releases_count=${#releases[@]}
if [ $releases_count -le $keep_releases ]
- (void)expire:(NSString *)offerId success:(void (^)(BOOL))success failure:(ErrorBlock)failure {
[self deletePath:[NSString stringWithFormat:@"/offers/%@", offerId] parameters:nil
success:^(AFHTTPRequestOperation *o, id rsp) {
if (success) {
success(YES);
}
}
failure:[self handleError:failure]];
}
- (void)expire:(NSString *)offerId success:(void (^)(BOOL))success failure:(ErrorBlock)failure {
[self deletePath:[NSString stringWithFormat:@"/offers/%@", offerId] parameters:nil
success:^(AFHTTPRequestOperation *o, id rsp) {
if (success) {
success(YES);
}
}
failure:[self handleError:failure]];
}
Pod::Spec.new do |s|
s.name = 'UrbanAirship-iOS-SDK'
s.version = '2.1.0'
s.license = 'BSD'
s.platform = :ios
s.summary = 'A simple way to integrate Urban Airship services into your iOS applications.'
s.homepage = 'https://github.com/urbanairship/ios-library'
s.author = { 'Urban Airship' => 'support@urbanairship.com' }
s.source = { :git => 'https://github.com/urbanairship/ios-library.git', :tag => '2.1.0' }