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
| # Example Backbone.js app in CoffeeScript | |
| # compile on each file save using the coffee bin | |
| # coffee -b -c -w app.coffee | |
| # BACKBONE.JS MODEL | |
| class Blog extends Backbone.Model | |
| sync: -> "noop" | |
| url: -> |
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
| #!/bin/bash | |
| # get yesterdays date | |
| datestring=`date -v"-1d" +%Y%m%d` | |
| filename_gzipped=mydbbackup-$datestring.sql.gz | |
| filename_gunzipped=mydbbackup-$datestring.sql | |
| database_name=mydb | |
| scp somegai@example.com:/home/somegai/backups/$filename_gzipped ~/backups/ | |
| gunzip ~/backups/$filename_gzipped |
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
| Quickbooks OL-222 error help | |
| Quickbooks QBO files are based on the OFX spec. | |
| Instead of reading the spec, here are the actual real | |
| world rules since Intuit doesn't appear to care about documentation or helping. | |
| This is particularly useful if you want to avoid the "OL-222" error when | |
| trying to import your own QBO files. | |
| <STMTTRN> |
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
| class SkinnyJeanDb < ActiveRecord::Base | |
| self.abstract_class = true | |
| end | |
| SkinnyJeanDb.establish_connection(:adapter => 'sqlite3', :database => @sqlite_db_path) | |
| class Pageview < SkinnyJeanDb; end | |
| Pageview.count |
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
| /* CSS */ | |
| $height: 85px; | |
| $width: 700px; | |
| .container { position: relative } | |
| .card { | |
| height: $height; | |
| width: $width; | |
| z-index: 1; |
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
| # convert ruby hash to html table | |
| class Hash | |
| def to_html_table | |
| rows=self.collect do |k,v| | |
| "<tr><td>#{k}</td><td>#{v}</td></tr>" | |
| end | |
| "<table border=1 cellspacing=0 cellpadding=3>#{rows}</table>" | |
| 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
| # used for building filtering type links/UI | |
| # extract parameters from url so you can preserve them in new link | |
| # example.com/?val=2&cool=yes => val=2&cool=yes | |
| params.keys.reject{|key|key=~/action|controller/i}.collect{ |key| "#{key}=#{params[key]}" }.join("&") |
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
| # need to disable Rails.cache.fetch in test env | |
| # and ActionController::Base.perform_caching doesnt do it | |
| # from http://pivotallabs.com/users/spierson/blog/articles/818-standup-04-30-2009-perform-caching-and-rails-cache-w3c-dtds-and-ie-range-min-max | |
| class BlackHoleStore | |
| def logger | |
| Rails.logger | |
| end | |
| def fetch( *args ) |
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 :bundler do | |
| task :install, :roles => :app, :except => { :no_release => true } do | |
| run("gem install bundler --source=http://gemcutter.org") | |
| end | |
| task :symlink_vendor, :roles => :app, :except => { :no_release => true } do | |
| shared_gems = File.join(shared_path, 'vendor/gems/ruby/1.8') | |
| release_gems = "#{release_path}/vendor/gems/ruby/1.8" | |
| # if you don't commit your cache, add cache to this list | |
| %w(gems specifications).each do |sub_dir| |
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
| # you'd obviously have more settings somewhere | |
| set :scm, :git | |
| set :repository, "git@github.com:defunkt/github.git" | |
| set :branch, "origin/master" | |
| set :migrate_target, :current | |
| set(:latest_release) { fetch(:current_path) } | |
| set(:release_path) { fetch(:current_path) } | |
| set(:current_release) { fetch(:current_path) } |