Skip to content

Instantly share code, notes, and snippets.

View figwheel_client_socket_repl.clj
(require 'tubular.core)
(tubular.core/connect "127.0.0.1" REPL_PORT)
View partition-chan.cljs
(defn partition-chan
([start-pred in] (partition-chan start-pred (complement start-pred) in))
([start-pred end-pred in]
(let [out (chan)]
(go
(loop []
(if-let [val (<! in)]
(if (start-pred val)
(let [next-chan (chan)]
(>! out next-chan)
View partition-chan.cljs
(defn partition-chan
([start-pred in] (partition-chan start-pred (complement start-pred) in))
([start-pred end-pred in]
(let [out (chan)]
(go
(loop []
(if-let [val (<! in)]
(if (start-pred val)
(let [next-chan (chan)]
(>! out next-chan)
View gist:5267629
# run with: god -c /path/to/config.god [add -D if you want to not-deamonize god]
# This is the actual config file used to keep the delayed_job running
APPLICATION_ROOT = "/var/www/application"
RAILS_ENV = "production"
God.watch do |w|
w.name = "delayed_job_production"
w.interval = 15.seconds
w.start = "/bin/bash -c 'cd #{APPLICATION_ROOT}/current; /usr/bin/env RAILS_ENV=#{RAILS_ENV} #{APPLICATION_ROOT}/current/script/delayed_job start > /tmp/delay_job.out'"
@bhauman
bhauman / hack.sh
Created Mar 31, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@bhauman
bhauman / minidress.rb
Created Feb 11, 2010 — forked from stephencelis/minidress.rb
Minidress a lightweight factory_girl which will work outside of Rails(I use it with jruby_appengine/Sinatra)
View minidress.rb
# the more proper miniskirt who doesn't have to walk the rails
class Minidress
@@factories = {}
class << self
def define(name, &block)
@@factories[name.to_s] = block
end
def build(name, attrs = {})
View blue_yellow.haml
!!!
%html
%head
%style(type="text/css")
:plain
body {
color: blue;
background: yellow;
}
%body
View no_www.rb
class NoWWW
STARTS_WITH_WWW = /^www\./i
def initialize(app)
@app = app
end
def call(env)
if env['HTTP_HOST'] =~ STARTS_WITH_WWW
View layout_wrapper.rb
require 'rack'
# sudo gem install tilt --source http://gemcutter.org/
require 'tilt'
# A simple Rack middleware which makes it super easy
# have a shared layout rendering system used across
# different rails applications.
#
# Examples:
#
View lark_template.rb
# download and git methods swiped from http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
require 'open-uri'
def download(from, to = from.split("/").last)
#run "curl -s -L #{from} > #{to}"
file to, open(from).read
rescue
puts "Can't get #{from} - Internet down?"
exit!
You can’t perform that action at this time.