Skip to content

Instantly share code, notes, and snippets.

View randomm's full-sized avatar

Janni Turunen randomm

  • Helsinki
View GitHub Profile
mkdir heroku
cd heroku/
virtualenv --no-site-packages env
source env/bin/activate
pip install bottle gevent
pip freeze > requirements.txt
cat >app.py <<EOF
try:
import gevent.monkey
@randomm
randomm / octopus.rb
Last active November 6, 2015 12:02 — forked from eprothro/octopus.rb
Octopus initializer for use with master/slave horizontal DB scaling with a Rails application on the Heroku stack. See the wiki page for more info: https://github.com/tchandy/octopus/wiki/Replication-with-Rails-on-Heroku
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
def self.random_follower
followers.sample.to_sym
end

Keybase proof

I hereby claim:

  • I am randomm on github.
  • I am randomm (https://keybase.io/randomm) on keybase.
  • I have a public key whose fingerprint is 0A24 973B 04AF ED25 C7B6 DCE1 9261 6DA0 80CA 5850

To claim this, I am signing this object:

// jQuery no-double-tap-zoom plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
var IS_IOS = /iphone|ipad/i.test(navigator.userAgent);
$.fn.nodoubletapzoom = function() {
if (IS_IOS)
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp