Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🤦‍♂️

Josh Kalderimis joshk

💭
🤦‍♂️
View GitHub Profile
View gist:1012154
module UnicornPowers
def fire_super_ray_beam
ray_beam_power
end
def ray_beam_power
"pow"
end
end
View lookup_context.rb
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/object/blank'
module ActionView
# = Action View Lookup Context
#
# LookupContext is the object responsible to hold all information required to lookup
# templates, i.e. view paths and details. The LookupContext is also responsible to
# generate a key, given to view paths, used in the resolver cache lookup. Since
# this key is generated just once during the request, it speeds up all cache accesses.
View macruby_http_example.rb
MacRubyHTTP.post("https://our.application.url.com", {
:payload => some_json_payload,
:headers => { 'Content-Type' => 'application/json' }) do |lh|
NSLog(lh.inspect)
end
@joshk
joshk / em_deferrable.rb
Created Mar 6, 2011
em deferrable faraday adapter
View em_deferrable.rb
module Faraday
class Adapter
class EMHttpRequest < Faraday::Adapter
self.supports_parallel_requests = true
def self.setup_parallel_manager(options = {})
EMParallelManager.new
end
class EMParallelManager
View help.js
render: function(username) {
var self = this;
this.repositories.fetch({ success: function() {
var content = this.templates.list({
builds_list_title: "Recent Builds",
repositories: Travis.Collections.Repositories.toJSON()
});
self.el.fadeOut('fast', function() {
@joshk
joshk / habtm_destroy_test.rb
Created Feb 9, 2011
Example code for Fix Destroy Arity rails pull request
View habtm_destroy_test.rb
# Dev with custom destroy taking extra params
class DeveloperWithCustomDestroyMethod < ActiveRecord::Base
self.table_name = 'developers'
has_and_belongs_to_many :projects, :join_table => 'developers_projects', :foreign_key => 'developer_id'
def destroy(options ={})
super
end
end
View elixir.diff
diff --git a/lib/list.ex b/lib/list.ex
index 75778f7..10d6cf7 100644
--- a/lib/list.ex
+++ b/lib/list.ex
@@ -1,5 +1,13 @@
object List
- def +(another)
+ % Returns a new list with the contents of the
+ % current list and the other list.
+ %
View squareup_spec.rb
require 'bigdecimal'
class Payment
FEE_PERCENTAGE = BigDecimal.new('2.9')
FEE_SET_AMOUNT = BigDecimal.new('0.15')
attr_reader :amount
def initialize(amount)
@amount = BigDecimal.new(amount.to_s)
View binding_test.rb
def root_binding
binding
end
module Blah
def self.root_binding
@root_binding
end
View gist:784304
# - TS related capistrano tasks
require "vendor/plugins/thinking-sphinx/lib/thinking_sphinx/deploy/capistrano"
require 'new_relic/recipes'
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
# Global deployment information
You can’t perform that action at this time.