Skip to content

Instantly share code, notes, and snippets.

View minch's full-sized avatar

Adam Weller minch

View GitHub Profile
@jnunemaker
jnunemaker / mongo_mapper_new_relic.rb
Created January 8, 2010 09:04
MongoMapper NewRelic Integration
# Have to use ActiveRecord so that New Relic shows it on all graphs.
# The push scope false stuff makes it so that you can track usage by model and overall.
if defined?(NewRelic)
module MongoMapperNewRelic
def self.included(model)
mm_class_methods = [
:find,
:find!,
:paginate,
:first,
@bryanl
bryanl / 37singals REE GC environment
Created October 27, 2010 15:54
37signals ree settings
RUBY_HEAP_MIN_SLOTS=600000
RUBY_GC_MALLOC_LIMIT=59000000
RUBY_HEAP_FREE_MIN=100000
RUBY_HEAP_MIN_SLOTS=500000
RUBY_HEAP_SLOTS_INCREMENT=250000
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
RUBY_GC_MALLOC_LIMIT=50000000
@budu
budu / sy.clj
Created May 3, 2011 00:08
Monadic implementation of the Shunting-yard algorithm
(ns sy
"Monadic implementation of the Shunting-yard algorithm, including
infix binary operator with associativity, function calls and basic
sequence support. It transalate a simple C like expression syntax into
s-expression that can be evaluated by Clojure.
1 + 2 => (+ 1 2)
1 + 2 * 3 => (+ 1 (* 2 3))
1 * 2 + 3 => (+ (* 1 2) 3)
(1 + 2) * 3 => (* (identity (+ 1 2)) 3)
/**
NOTE: The template in this example relies on itemView, which is not yet
in SproutCore 2.0 master, but is coming
*/
MyApp.Selection = SC.Object.extend({
name: null,
isSelected: false
});
@somebox
somebox / backbone.rails.js
Created June 30, 2011 10:42 — forked from trydionel/backbone.rails.js
Makes Backbone.js with Rails+CSRF
//
// Backbone.Rails.js
//
// Makes Backbone.js play nicely with the default Rails setup, i.e.,
// no need to set
// ActiveRecord::Base.include_root_in_json = false
// and build all of your models directly from `params` rather than
// `params[:model]`.
//
// Load this file after backbone.js and before your application JS.
@patmaddox
patmaddox / render_with_comments.rb
Created August 30, 2011 16:38
HTML comments to tell you what partial is rendering
# Throw a comment in before and after every render call on html based templates
module ActionView # :nodoc: all
class Base
alias_method :render_file_without_comments, :render
attr_accessor :render_stack
def render(options = {}, local_assigns = {}, &block)
self.render_stack ||= []
if options[:partial]
@tomerd
tomerd / gauge.js
Last active April 21, 2024 21:08
google style gauges using javascript d3.js
function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;
@LeaVerou
LeaVerou / dabblet.css
Last active September 20, 2023 08:11
Move in a circle without wrapper elements
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
transform: rotate(0deg)
translate(-150px)
rotate(0deg);
module DonorsChoose
extend self
attr_accessor :api_key
def projects_near_me(latitude, longitude)
Request.get(:centerLat => latitude, :centerLong => longitude)
end
def projects_by_zip(zipcode)
Request.get(:keyword => zipcode)