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 'uri' | |
| require 'tinder' | |
| class Campfire | |
| attr_reader :config | |
| def initialize(config) | |
| @config = config | |
| 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
| #!/usr/bin/env ruby | |
| def run_testunit(runner, path) | |
| path = path.gsub(/\/?test\/?/, '') | |
| path.gsub!(/_test.rb/, '') | |
| exec "#{runner} -I'test' test/#{path}_test.rb" | |
| end | |
| def run_unit(runner) | |
| run_testunit runner, "unit/#{ARGV[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
| stubs = [] | |
| module.exports = | |
| stub: (obj, name, fun) -> | |
| stubs.push({'obj':obj, 'name':name, 'fun':obj[name]}) | |
| obj[name] = if fun? then fun else -> | |
| unstub: -> | |
| for stubbed in stubs | |
| stubbed.obj[stubbed.name] = stubbed.fun | |
| stubs.length = 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
| function House() { | |
| this.vandalize = function() { | |
| this.vandalized = true; | |
| } | |
| } | |
| function Punk() { | |
| this.onParty = function(handler) { | |
| this.handler = handler; | |
| } |
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
| # Compile the coffee in bare joined mode. | |
| {exec, spawn} = require 'child_process' | |
| fs = require 'fs' | |
| util = require 'util' | |
| print = (data) -> | |
| console.log data.trimRight() | |
| task 'build', 'Compile Coffeescript to Javascript', -> |
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
| next unless delivery_message = | |
| begin | |
| Message.find_by_id(message.id) | |
| rescue SecurityContextException => ex | |
| logger.warn{ "message_broadcaster Could not load message #{message.id} for user #{subscription.user.id}" } | |
| end | |
| if subscription.client.delivery_appropriate?(delivery_message) | |
| # logger.debug{ "SENDING mid: #{message.id} to uid:#{subscription.client.user_id} client_id:#{subscription.client}" } | |
| subscription.client.deliver_message(delivery_message) | |
| else |
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
| let mapleader = "," | |
| call pathogen#infect("~/.vim/langs") | |
| call pathogen#infect() | |
| "" | |
| "" File types | |
| "" | |
| " Some file types should wrap their text |
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
| irb(main):009:0> GC.enable_stats | |
| => false | |
| irb(main):013:0> GC.clear_stats | |
| => nil | |
| irb(main):014:0> n.ar_users.select("id").find_in_batches(:batch_size => 1000) {|u| u } | |
| => nil | |
| irb(main):015:0> GC.allocated_size | |
| => 902823508 | |
| irb(main):016:0> ObjectSpace.allocated_objects | |
| => 104920800 |
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
| def cats(user_id, network_id) | |
| email = "bob#{user_id}_#{network_id}@weird.com" | |
| n = Network.find_or_create_by_email(email) | |
| mu = MetaUser.find_or_create_by_email(email) | |
| User.create do |u| | |
| u.id = user_id | |
| u.network = n | |
| u.meta_user = mu | |
| 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
| [ | |
| { | |
| "type": "exception", | |
| "time": "2011-09-12T21:33:12Z" | |
| }, | |
| { | |
| "type": "exception", | |
| "time": "2011-09-12T21:35:12Z" | |
| } | |
| ] |