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
if (Meteor.isClient) { | |
Meteor.subscribeReactive = function(name) { | |
// ... | |
}; | |
} | |
var relations = {}; | |
Meteor.Collection.prototype.relations = function(relations) { | |
relations[this._name] = relations; | |
}; |
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 Future = Npm.require('fibers/future'); | |
var onePerRecordParallel = function(cursor, name, fn) { | |
if (! _.isFunction(fn)) | |
throw "Must pass function into `onePerRecordParallel`"; | |
var count = cursor.count(); | |
Log('Updating ' + count + ' ' + name + 's'); | |
if (! count) | |
return 0; |
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 update(url) { | |
var index = $buttons.find('[href=' + url + ']').parents('li').index(); | |
$buttons.removeClass('current').eq(index).addClass('current'); | |
$slides.removeClass('current').eq(index).addClass('current'); | |
} |
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
# 1. Install rbenv [https://github.com/sstephenson/rbenv] | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
exec $SHELL | |
# 2. Install ruby-build [https://github.com/sstephenson/ruby-build] | |
cd [Some source code directory] | |
git clone git://github.com/sstephenson/ruby-build.git |
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
This code is vaguely based on the action mailer rails guide example. Now try: | |
/test/email?type=welcome&part=text | |
This is the plain text part of the email | |
/test/email?type=welcome&part=css | |
This is the html part, before premailing, standard css, easier to debug | |
/test/email?type=welcome&part=html | |
This is the premailed part, there are sometimes subtle differences. |
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
ApplicationController < ActionController::Base | |
before_filter :track_referer | |
protected | |
def track_referer | |
@referer = session[:referer] ||= parse_referer(request.headers['HTTP-REFERER']) | |
end | |
def parse_referer(url) |
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
require 'rubygems' | |
require 'active_record' | |
# Print out what version we're running | |
puts "Active Record #{ActiveRecord::VERSION::STRING}" | |
# Connect to an in-memory sqlite3 database | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => ':memory:' |
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
# copied from https://gist.github.com/1131536, thanks christian peters. | |
module CssSplitter | |
def self.split(infile, outdir = File.dirname(infile), max_selectors = 4095) | |
charset_statement, rules = self.read_rules(infile) | |
return if rules.nil? | |
self.partition_rules(rules, max_selectors).each_with_index do |ruleset, index| | |
next if index == 0 # no need to write out the first file | |
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
$element.on('click', '.next', function() { | |
// find the next frame that isn't completely on the screen | |
var $next_frame = $element.find('.frame').filter(function() { | |
return $(this).position().left + $(this).width() > $element.scrollLeft() + $element.width(); | |
}).eq(0) | |
// scroll it into view | |
$element.scrollTo($next_frame, 'medium'); | |
}); |
OlderNewer