Laust Rud Jacobsen rud

View prune.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
 
# Simple script for pruning local branches already merged,
# and remove remote tracking branches that have been deleted
 
# Default to "origin" if no remote is passed
remote=${1-origin}
 
# Branches to keep, regardless of their current merge state
permanent_branches="develop|master|production"
View vol
1 2 3 4 5 6 7 8 9 10
# --------------------------------------------------------
# vol as a shell script
# --------------------------------------------------------
# You would put this code in a directory that's in your
# path, like ~/bin (PATH=~/bin:$PATH in your .bashrc to
# add a directory like that to your path.)
# The invokation syntax is the same as that of the
# function.
# --------------------------------------------------------
# Example usage:
View vol
1 2 3 4 5 6 7 8 9 10
# --------------------------------------------------------
# vol as a shell script
# --------------------------------------------------------
# You would put this code in a directory that's in your
# path, like ~/bin (PATH=~/bin:$PATH in your .bashrc to
# add a directory like that to your path.)
# The invokation syntax is the same as that of the
# function.
# --------------------------------------------------------
# Example usage:
View gist:4045605
1 2 3 4 5 6 7 8 9 10
class ToggleLogging
def self.setup
Signal.trap('USR1') do
toggle
end
end
 
def self.toggle
level_before = Rails.logger.level == Logger::DEBUG
Rails.logger.level = debug_before ? Logger::INFO : Logger::DEBUG
View gist:2988115

If you use tests of the form: User.accessible_attributes.should =~ [:email, :password] you'll get an extra attribute called "" if you set config.active_record.whitelist_attributes = true, and thus a specfailure. Annoying.

Instead, you can add this to your config/application.rb:

# Require attr_accessible to be used on all models for mass-assignment to work
ActiveRecord::Base.instance_eval do
  attr_accessible # none - and this method doesn't whitelist an attribute with the name ""
end
View Gemfile.lock
1 2 3 4 5 6 7 8 9 10
PATH
remote: .
specs:
em-postgresql-adapter (0.2)
activerecord (>= 3.1.0)
eventmachine
pg (>= 0.8.0)
 
GEM
remote: http://rubygems.org/
View unicorn_development.rb
1 2 3 4 5 6 7 8 9 10
listen 3000
 
worker_processes 1
timeout 30
 
preload_app true
 
 
after_fork do |server, worker|
require "amqp"
View postgresql.rb
1 2 3 4 5 6 7 8 9 10
require 'formula'
require 'hardware'
 
class Postgresql <Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.4.8/postgresql-8.4.8.tar.bz2'
md5 '4603e8ea30cee97189b62b39022f2043'
 
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 #system libxml is too old
View Current console output (consistent)
1 2 3 4 5 6 7 8 9 10
ruby demo-amqp-one-message-subscribers.rb
single-message consumer listening to rapid producer
> PUT msg 0
> PUT msg 1
> PUT msg 2
> PUT msg 3
< GET msg 2 [waited 0.05s][18.95 reqs/sec]
/Users/rud/.rvm/gems/ruby-1.9.2-head@bundler/gems/amq-client-0.8.3/lib/amq/client/async/consumer.rb:246:in `block in <class:Consumer>': undefined method `handle_delivery' for nil:NilClass (NoMethodError)
from /Users/rud/.rvm/gems/ruby-1.9.2-head@bundler/gems/amq-client-0.8.3/lib/amq/client/async/adapter.rb:535:in `call'
from /Users/rud/.rvm/gems/ruby-1.9.2-head@bundler/gems/amq-client-0.8.3/lib/amq/client/async/adapter.rb:535:in `receive_frameset'
View gist:1055675
1 2 3 4 5 6 7 8 9 10
(heroku console)$ User.connection.execute("select to_tsvector('danish', 'vi kigger p\303\245 biler og huse')").to_set
=> #<Set: {{"to_tsvector"=>"'bil':4 'hus':6 'kig':2"}}>
 
 
(psql)$ \dF+ danish
Text search configuration "pg_catalog.danish"
Parser: "pg_catalog.default"
Token | Dictionaries
-----------------+--------------
asciihword | danish_stem
Something went wrong with that request. Please try again.