Skip to content

Instantly share code, notes, and snippets.

View catsby's full-sized avatar
🏠
Working from home

Clint catsby

🏠
Working from home
View GitHub Profile
@catsby
catsby / shards.yml
Created October 10, 2013 19:12 — forked from eprothro/shards.yml
<%
require 'cgi'
require 'uri'
def attribute(name, value, force_string = false)
if value
value_string =
if force_string
'"' + value + '"'
else
@catsby
catsby / octopus.rb
Created October 10, 2013 19:00 — forked from eprothro/octopus.rb
module Octopus
def self.shards_in(group=nil)
config[Rails.env].try(:[], group.to_s).try(:keys)
end
def self.followers
shards_in(:followers)
end
class << self
alias_method :followers_in, :shards_in
alias_method :slaves_in, :shards_in
@catsby
catsby / shards.yml
Created October 10, 2013 19:00 — forked from eprothro/shards.yml
<%
require 'cgi'
require 'uri'
def attribute(name, value, force_string = false)
if value
value_string =
if force_string
'"' + value + '"'
else
@catsby
catsby / py.py
Created May 15, 2012 19:25 — forked from bryanhelmig/py.py
queue examples
# bad way
def new_message(request):
user = get_user_or_404(request)
message = request.POST.get('message', None)
if not message:
raise Http404
user.save_new_message(message)
@catsby
catsby / examples.js
Created March 21, 2012 20:21 — forked from bryanhelmig/examples.js
EmailPie Samples
// An invalid domain.
// http://emailpie.com/v1/check?email=notreal@example.com
{
"didyoumean": null,
"errors": [
{
"message": "No MX records found for the domain.",
"severity": 7
}
@catsby
catsby / gist:943028
Created April 26, 2011 20:16 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{sub(/origin\//,"");print}' |
xargs git push origin --delete