Skip to content

Instantly share code, notes, and snippets.

Avatar

Sven Fuchs svenfuchs

View GitHub Profile
@mislav
mislav / template-uri.rb
Created Sep 27, 2009
URI templates are, like, super-useful
View template-uri.rb
# https://github.com/sporkmonger/addressable/
require 'addressable/template'
# http://dev.twitter.com/doc/get/statuses/followers
template = Addressable::Template.new 'http://{host=twitter.com}' +
'/statuses/followers{-prefix|/|id}.{format=json}' +
'?{-join|&|user_id,screen_name,cursor}'
template.expand(:id => 'mislav')
# => http://twitter.com/statuses/followers/mislav.json?
View include_anonymous.rb
# Include an anonymous module
#
# Useful for defining a class with a base module. So, instead of:
#
# class Foo
# module Base
# def bar
# # ...
# end
# end
View gist:1062178
vagrant@lucid32:~$ sudo su postgres
postgres@lucid32:/home/vagrant$ psql
psql (8.4.8)
Type "help" for help.
postgres=# SELECT * FROM pg_user;
usename | usesysid | usecreatedb | usesuper | usecatupd | passwd | valuntil | useconfig
----------+----------+-------------+----------+-----------+----------+----------+-----------
postgres | 10 | t | t | t | ******** | |
rails | 16385 | t | t | t | ******** | |
@technoweenie
technoweenie / .gitignore
Created Feb 20, 2012
quick kestrel zeromq port attempt
View .gitignore
node_modules
@technoweenie
technoweenie / heartbeat.rb
Created Feb 21, 2012
heartbeat actor w/ celluloid
View heartbeat.rb
require 'rbczmq'
require 'fileutils'
require 'celluloid'
class Heartbeat
include Celluloid
def self.start(id = nil, options = nil)
new(ZMQ::Context.new, id, options)
end
@saimonmoore
saimonmoore / gist:1883590
Created Feb 22, 2012
Clear out your dev db (with protection from #epicfailure)
View gist:1883590
function cleardb {
DEVDB="`ruby -e "require 'yaml'; puts YAML.load(File.open('config/database.yml'))['development']['database']"`"
if [[ $DEVDB =~ "production" ]]; then
echo 'WATCHOUT! cleardb running against production dump';
else
bundle exec rake db:drop db:create db:schema:load db:seed && bundle exec rake db:test:clone;
fi
}
View Vagrantfile
# Save this in an empty directory as Vagrantfile and run:
#
# gem install vagrant
# vagrant up
# vagrant ssh
#
# You need to have a recent VirtualBox installed.
Vagrant::Config.run do |config|
config.vm.box = "travis-ruby"
config.vm.box_url = "http://files.travis-ci.org/boxes/provisioned/travis-ruby.box"
View study_group_topics.md
  • Strings
  • Arrays
  • Hashes
  • Classes
  • Conditionals (if)
  • Conditional (case)
  • Modules (for mixins)
  • Namespaces
  • requiring
  • Gems
@svenfuchs
svenfuchs / gist:5364262
Last active Dec 16, 2015
Travis CI Office
View gist:5364262

The Travis CI office

How to get to the Travis CI office: http://goo.gl/maps/vmidH

The address is Prinzessinnenstrasse 20, on the left driveway:

View ruby_confs_2013.md