Skip to content

Instantly share code, notes, and snippets.

View robinator's full-sized avatar
🤡

Rob Law robinator

🤡
View GitHub Profile
@robinator
robinator / movies-to-watch
Last active March 23, 2020 14:02
Movies to watch
Hush - John Gallagher Jr.
https://en.wikipedia.org/wiki/Kill_List
https://en.wikipedia.org/wiki/The_Conspiracy_(2012_film)
https://vimeo.com/ondemand/MEMORYprogram1
Goodnight mommy - German twins movie
It follows
Babadook
https://en.wikipedia.org/wiki/The_Petrified_Forest
https://en.wikipedia.org/wiki/The_Iceman_Cometh
https://en.wikipedia.org/wiki/Key_Largo_(film)

Keybase proof

I hereby claim:

  • I am robinator on github.
  • I am roblaw (https://keybase.io/roblaw) on keybase.
  • I have a public key whose fingerprint is DF10 EA6A 6576 AF9E 5419 2658 C825 C02B 3714 E65B

To claim this, I am signing this object:

@robinator
robinator / active_record_enums.rb
Created April 9, 2014 02:33
Add enum capabilities to your active record objects
# this adds enum capibilities to an active record model
# http://jeffkreeftmeijer.com/2011/microgems-five-minute-rubygems/
module ActiveRecordEnum
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# how to define an enum on a model
# pass :prefix => true to prefix the ? methods with attribute name
@robinator
robinator / ubuntu-setup.sh
Created September 25, 2013 15:40
Script / commands to setup a rails / mysql ubuntu server.
apt-get update
apt-get install build-essential openssl libreadline6 libreadline6-dev curl libcurl4-openssl-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config memcached libsasl2-dev gettext mysql-client libmysqlclient-dev imagemagick libmagickwand-dev
# http://aws.amazon.com/articles/1233
# 0) Add deploy user and make sudoer
adduser deploy admin
passwd deploy
# 1) First install rvm system-wide
@robinator
robinator / gist:1934684
Created February 28, 2012 19:50
Deploying Rails 3.2 to passenger.
# http://guides.rubyonrails.org/asset_pipeline.html
Add:
<LocationMatch "^/assets/.*$">
Header unset ETag
FileETag None
# RFC says only cache for 1 year
ExpiresActive On
ExpiresDefault "access plus 1 year"
</LocationMatch>
to v-host file.
@robinator
robinator / rvm-install.sh
Created October 21, 2011 17:54
RVM installation for Flywheel
## As root
# https://rvm.beginrescueend.com/rvm/install/
groupadd rvm
curl -L https://get.rvm.io | bash -s stable --ruby
# add below to ~/.bash_profile at bottom (for both root and deploy)
[[ -s '/usr/local/lib/rvm' ]] && source '/usr/local/lib/rvm'
# add below to ~/.gemrc at bottom (for both root and deploy)
install: --no-rdoc --no-ri
@robinator
robinator / binary_search.coffee
Created October 23, 2010 22:40
Binary search implemented in coffeescript.
binary_search = (val, L) ->
return false if L.length == 0
mid = Math.floor(L.length / 2)
if L[mid] == val
return mid
else if val > L[mid]
binary_search(val, L[(mid + 1)..(L.length)])
else
binary_search(val, L[0..(mid - 1)])
rob = [
%w{Lakers 5},
%w{Nuggets 5},
%w{Suns 6},
%w{Spurs 6},
%w{Cavs 5},
%w{Celtics 5},
%w{Hawks 5},
%w{Magic 6},
%w{Lakers 6},