This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# output the fibonacci series to n in the series | |
# | |
def fibonacci(n, last = 1, previous = 0) | |
puts previous | |
current = last + previous | |
return if n == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fix to make Rails 4 work with Postgres gem > 0.20.0 | |
# | |
# place this in your config/application.rb just after the Bundler.require() line | |
module Kernel | |
def gem_with_pg_fix(dep, *reqs) | |
if dep == "pg" && reqs == ["~> 0.15"] | |
reqs = ["~> 1.0"] | |
end | |
gem_without_pg_fix(dep, *reqs) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# usage: redis-del-keys these:ones:* | |
redis-del-keys() { | |
redis-cli --scan --pattern $1 | xargs redis-cli del | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# import am DNS zone file into Hover | |
# | |
# first get your domain ID from here: | |
# https://www.hover.com/api/domains/yourdomain.com/dns/ | |
# | |
# install the required gems: | |
# | |
# gem install hover dns-zone |