This file contains hidden or 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
// the old way | |
#pragma mark - | |
#pragma mark Section Name | |
// the new way | |
#pragma mark - Section Name |
This file contains hidden or 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
function svn_del | |
{ | |
svn status | grep '\!' | awk '{print $2;}' | xargs svn rm; | |
} |
This file contains hidden or 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
require 'spec_helper' | |
describe User do | |
before(:each) do | |
@user = User.new | |
end | |
context 'creating users' do |
This file contains hidden or 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
- (void)drawRect:(CGRect)rect | |
{ | |
// line weight | |
CGFloat strokeWidth = 2.0f | |
// adjust size of the canvas to get rid of nasty jaggies | |
rect.size.width -= strokeWidth; | |
rect.size.height -= strokeWidth; | |
rect.origin.x += strokeWidth / 2.0; | |
rect.origin.y += strokeWidth / 2.0; |
This file contains hidden or 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
# installing the gem after | |
# brew install postgresql | |
sudo env ARCHFLAGS="-arch x86_64" gem install --no-ri --no-rdoc pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.0.4/bin/pg_config | |
# in rails app | |
export PATH=/usr/local/Cellar/postgresql/9.0.4/bin:$PATH | |
export ARCHFLAGS="-arch x86_64" | |
bundle install |
This file contains hidden or 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
namespace :heroku do | |
desc "Create a Heroku app and install the necessary addons" | |
task :bootstrap, [:app, :domain] => [:create, :install_addons] do |t, args| | |
APP = args[:app] | |
DOMAIN = args[:domain] | |
puts "= Bootstrapping Heroku application #{APP}" | |
Rake::Task['heroku:create'].invoke(APP) | |
Rake::Task['heroku:install_addons'].invoke(APP, DOMAIN) | |
puts "= Finished building stack for #{APP}" |
This file contains hidden or 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
require 'aws/s3' | |
namespace :s3 do | |
desc "Upload assets to AWS s3" | |
task :deploy, [:bucket] => [:environment] do |t, args| | |
config ||= YAML.load(ERB.new(IO.read(File.join(Rails.root, "config/s3.yml"))).result)[Rails.env] rescue nil || {} | |
bucket = args[:bucket].present? ? args[:bucket] : config['bucket'] | |
uploads = [] | |
files = Pathname.glob('public/**/*').each do |pn| |
This file contains hidden or 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 | |
s = STDIN.read | |
s.downcase! | |
s.gsub!(/[^A-Za-z0-9_\- ]/, '') | |
s.gsub!(/ /, '-') | |
print s |
This file contains hidden or 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
# config/routes.rb | |
AppName::Application.routes.draw do | |
# API routing with versioned namespace | |
scope :constraints => AppName::Ssl do | |
namespace :api do | |
namespace :v1 do | |
# routes here | |
end | |
end | |
end |
This file contains hidden or 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
# Returns recent activity for the authenticated user | |
def activity | |
cache_key = "activity_#{@api_user[:id]}" | |
@activity = Rails.cache.fetch(cache_key) do | |
Record.activity.any_of({:to => @api_user[:id]}, {:from => @api_user[:id]}).entries | |
end | |
render :json => @activity | |
end |