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
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| 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
| #include <stdlib.h> | |
| #include <stdio.h> | |
| int(*outer(int val))() { | |
| int inner() { | |
| return val; | |
| } | |
| return inner; | |
| } |
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
| // iOS Media Queries | |
| // Goal: capture styles for iPhone, iPhone 3G, iPhone 3GS, iPhone 4, iPhone 4S, iPad, and iPad 2 | |
| // | |
| // Author: Tony Schneider (@tonywok) | |
| // Please tell me where I fail. :) | |
| // iPhone v(4,4S) portrait | |
| // test: black text (overwritten by v* portrait) with blue background | |
| @media all and (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) { | |
| a { |
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
| person = { | |
| save: function(){ | |
| $.ajax('...', { | |
| context: this, | |
| success: this.saved, | |
| error: this.errored | |
| }) | |
| }, | |
| saved: function(data){ | |
| console.log('OMG. USEFUL SCOPING.') |
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
| # This is a record, as in a vinyl. | |
| class Record < ActiveRecord::Base | |
| belongs_to :user | |
| belongs_to :album | |
| # explicitly stating what is needed | |
| def from_library_for_album(collector, album) | |
| where(user_id: collector).where(album_id: album) | |
| 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
| class Lisp | |
| def initialize | |
| @env = { | |
| :label => lambda { |(name,val), _| @env[name] = val }, | |
| :quote => lambda { |sexpr, _| sexpr[0] }, | |
| :car => lambda { |(list), _| list[0] }, | |
| :cdr => lambda { |(list), _| list.drop 1 }, | |
| :cons => lambda { |(e,cell), _| [e] + cell }, | |
| :eq => lambda { |(l,r), _| l == r }, | |
| :if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) }, |
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
| ## Rails 3.2.0 (January 20, 2012) ## | |
| * Upgrade mail version to 2.4.0 *ML* | |
| * Remove Old ActionMailer API *Josh Kalderimis* |
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 Lisp | |
| def initialize | |
| @env = { | |
| :label => lambda { |(name,val), _| @env[name] = val }, | |
| :quote => lambda { |sexpr, _| sexpr[0] }, | |
| :car => lambda { |(list), _| list[0] }, | |
| :cdr => lambda { |(list), _| list.drop 1 }, | |
| :cons => lambda { |(e,cell), _| [e] + cell }, | |
| :eq => lambda { |(l,r), _| l == r }, | |
| :if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) }, |
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
| # Install with: | |
| # bash < <(curl -L https://raw.github.com/gist/1333785) | |
| # | |
| # Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
| echo "Installing ruby-debug with ruby-1.9.3-p0 ..." | |
| curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
| curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |
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
| # Install with: | |
| # bash < <(curl -L https://raw.github.com/gist/1982760) | |
| # | |
| # Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug | |
| echo "Installing ruby-debug with ruby-1.9.3-p125 ..." | |
| curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
| curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem |