Skip to content

Instantly share code, notes, and snippets.

View lukemelia's full-sized avatar
💭
Making Yapp better all the time and likely working on some Ember.js OSS

Luke Melia lukemelia

💭
Making Yapp better all the time and likely working on some Ember.js OSS
View GitHub Profile
# def handle_exception_with_exception_notifier(exception)
# params_to_send = (respond_to? :filter_parameters) ? filter_parameters(params) : params
# ExceptionNotifier.notify(exception, {:request => request, :session => session}.merge(params_to_send))
# end
class ExceptionNotifier
include Singleton
def rescue_action_in_public(exception)
end
~ $ mkdir src
~ $ cd src
~/src $ wget http://rubyforge.org/frs/download.php/58677/ruby-enterprise-1.8.6-20090610.tar.gz
~/src $ tar xzvf ruby-enterprise-1.8.6-20090610.tar.gz
~/src $ sudo ./ruby-enterprise-1.8.6-20090610/installer --auto=/opt/ruby-enterprise-1.8.6-20090610
#!/usr/bin/env ruby
source_dir = nil
if ARGV[0] == 'ree'
source_dir = lambda { |binary| "/opt/ruby-enterprise-1.8.6-20090610/bin/#{binary}" }
elsif ARGV[0] == 'mri'
source_dir = lambda { |binary| "/usr/bin/#{binary}18" }
else
raise ArgumentError.new("acceptable args are 'mri' and 'ree'")
end
#!/bin/sh
export RUBY_HEAP_MIN_SLOTS=500000
export RUBY_HEAP_SLOTS_INCREMENT=250000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=50000000
exec "/usr/bin/ruby" "$@"
POST http://www.kaltura.com/index.php/partnerservices2/getuiconf
Host: www.kaltura.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
WE.RealtimeNotificationListener = (function(){
var instanceMethods = {};
var staticMethods = {
listen: function(channel, notificationHandler) {
var realtimeNotificationsUrl = "http://" + location.host + "/rt/notifications?id=" + channel;
var realtimeNotificationsCookieName = 'channel_last_mod_' + channel;
var storedLastModifiedDate = $.cookie(realtimeNotificationsCookieName);
if (storedLastModifiedDate !== null) {
$.lastModified[realtimeNotificationsUrl] = storedLastModifiedDate;
}
require 'redis'
# SADD key, member
# Adds the specified <i>member</i> to the set stored at <i>key</i>.
redis = Redis.new
redis.sadd 'my_set', 'foo' # => true
redis.sadd 'my_set', 'bar' # => true
redis.sadd 'my_set', 'bar' # => false
redis.smembers 'my_set' # => ["foo", "bar"]
module Steps
module OauthHelper
def oauth_get(client_application, oauth_token, url)
oauth_headers_factory = OAuthHeadersFactory.new(client_application, oauth_token)
get_via_redirect(url, nil, oauth_headers_factory.headers_for_get(url))
end
def oauth_post(client_application, oauth_token, url, params)
oauth_headers_factory = OAuthHeadersFactory.new(client_application, oauth_token)
post_via_redirect(url,
New York, New York, 2459115
Los Angeles, California, 2442047
Chicago, Illinois, 2379574
Houston, Texas, 2424766
Phoenix, Arizona, 2471390
Philadelphia, Pennsylvania, 2471217
San Antonio, Texas, 2487796
Dallas, Texas, 2388929
San Diego, California, 2487889
San Jose, California, 2488042
ActiveRecord::Base.class_eval do
# ActiveRecord looks up the columns for a table each time it loads a class using that table
# With STI, this means repeated calls to 'SHOW FIELDS FROM table_name' for each subclass.
def self.columns
@@table_columns ||= {}
unless @@table_columns[table_name]
retrieved_columns = connection.columns(table_name, "#{name} Columns")
retrieved_columns.each { |column| column.primary = column.name == primary_key }
@@table_columns[table_name] = retrieved_columns