This file contains 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
source "http://rubygems.org" | |
gem 'thin' | |
gem 'cramp' | |
gem 'rack' |
This file contains 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 ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation | |
# has_many and has_one through belongs_to are broken becuase the order of the primary key | |
# and foreign table key need to be reversed. this detects and fixes it. | |
def association_join_with_through_belongs_to_fix | |
join = association_join_without_through_belongs_to_fix | |
if [:has_many, :has_one].include?(reflection.macro) && reflection.options[:through] && source_reflection.macro == :belongs_to | |
connection = reflection.active_record.connection | |
parent_table_name = connection.quote_table_name(parent.aliased_table_name) | |
parent_key = connection.quote_column_name(parent.primary_key) |
This file contains 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
" copy all this into a vim buffer, save it, then... | |
" source the file by typing :so % | |
" Now the vim buffer acts like a specialized application for mastering vim | |
" There are two queues, Study and Known. Depending how confident you feel | |
" about the item you are currently learning, you can move it down several | |
" positions, all the way to the end of the Study queue, or to the Known | |
" queue. | |
" type ,, (that's comma comma) |
This file contains 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 Foo(options) { | |
var privateInstanceVar = options.thing; | |
var publicInstanceVar = options.otherThing; | |
var publicInterface = { | |
publicFunction: publicFunction, | |
publicInstanceVar: publicInstanceVar | |
}; | |
return publicInterface; |
This file contains 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 Car | |
def initialize(model, engine = ::Engine.new) | |
@model = model | |
@engine = engine | |
end | |
def running | |
engine.running | |
end | |
This file contains 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
source 'https://rubygems.org' | |
gem 'activerecord', '~> 3.2' | |
gem 'activerecord-mysql2-adapter' | |
group :test do | |
gem 'rspec' | |
gem 'pry' | |
end |
This file contains 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
var Channels = require('./channels') | |
, Emitter = require('events').EventEmitter | |
var repeater = Channels.createRepeating(250, 'hello', 'world') | |
, emitter = new Emitter() | |
, emitterTestChannel = Channels.fromEmitter(emitter, 'test') | |
, mergedChannel = Channels.merge(repeater, emitterTestChannel) | |
, mappedChannel = Channels.map(function() { | |
return Array.prototype.join.call(arguments, ' ') | |
}, repeater) |
This file contains 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
var assert = require('assert') | |
function _if(predicate) { | |
return { | |
then: function(thenFn) { | |
return { | |
else: function(elseFn) { | |
predicate.map(function(val) { | |
if (val) thenFn() | |
else elseFn() |
This file contains 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
// result of `curl https://lydian.indabamusic.com/opportunities` | |
{ | |
"status": "success", | |
"message": null, | |
"data": [ | |
{ | |
"id": "1237fa00-c24c-11e2-94e4-12313b0b1241", | |
"slug": "device-you-think-you-know-remix-contest", | |
"name": "Device - \"You Think You Know\" Remix Contest", | |
"tempo": "179", |
This file contains 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
/** | |
* Removes all unread threads matching the query | |
* older_than:<interval> label:purge-after-<interval> | |
*/ | |
var intervals = ["1d", "7d", "1m"]; | |
function purgeAll() { | |
intervals.forEach(function(interval) { | |
var query = constructQuery(interval); | |
var threads = GmailApp.search(query); | |
Logger.log("Found " + threads.length + " matching query: " + query); |
NewerOlder