Skip to content

Instantly share code, notes, and snippets.

View jdhollis's full-sized avatar
🌊

J.D. Hollis jdhollis

🌊
View GitHub Profile
@jdhollis
jdhollis / resque_async_handling.rb
Created June 9, 2010 21:43
handle_asynchronously for Resque
module Resque
module AsyncHandling
# To disable (in config.after_initialize):
# Resque::AsyncHandling.enabled = false
mattr_accessor :enabled
self.enabled = true
def handle_asynchronously(original_method, params = { })
if enabled
now_method = "#{ original_method }_now"
gem 'resque', '>= 1.10.0'
gem 'heroku' # You will need the heroku gem for this too.
@RandomEtc
RandomEtc / README.mkd
Created September 28, 2010 00:11
smooth panning and zooming for polymaps
@mbostock
mbostock / .block
Last active February 8, 2016 23:13
Labeled points
license: gpl-3.0
@mbostock
mbostock / .block
Last active May 9, 2020 16:58
Polymaps + D3
license: gpl-3.0
@skippy
skippy / middleware.rb
Created June 6, 2011 17:19 — forked from xdissent/middleware.rb
delete vagrant vm's chef client and node from chef server on destroy
class OnDestroyMiddleware
def initialize(app, env)
@app = app
end
def call(env)
env["config"].vm.provisioners.each do |provisioner|
env.ui.info "Attempting to remove client #{provisioner.config.node_name}"
`knife client show #{provisioner.config.node_name}`
if $?.to_i == 0
@adeel
adeel / push-notifications.clj
Created July 26, 2011 01:03
Example of sending Apple push notifications with Clojure.
; Depends on [com.notnoop.apns/apns "0.1.6"].
(:import ('com.notnoop.apns APNS))
(defn send-push-notification [device-token message]
(let [service (.build (.withSandboxDestination
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password")))
payload (.build (.alertBody (APNS/newPayload) message))]
(.push service device-token payload)))
@dblock
dblock / carrierwave.rb
Created January 31, 2012 13:55
Delayed image processing with CarrierWave
CarrierWave.configure do |config|
...
end
Mongoid::Document::ClassMethods.send(:include, DelayedImageProcessing)
module CarrierWave
# http://sleeplesscoding.blogspot.com/2011/09/recreate-single-version-of.html
# Note: is_processing_delayed should be set before calling recreate_version! if the version depends on it.
heroku addons:add deployhooks:http url="http://airbrake.io/deploys.txt?deploy[rails_env]=YOUR_ENVIRONMENT&api_key=YOUR_API_KEY&deploy[local_username]={{user}}&deploy[scm_repository]=git@github.com:youruser/your-repo.git&deploy[scm_revision]={{head}}" --app heroku_app_name