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 | |
require 'bundler/inline' | |
$gem_versions = { | |
"oj" => "3.0.5", | |
"msgpack" => "1.1.0", | |
"google-protobuf" => "3.2.0.2" | |
} | |
gemfile do |
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
require 'rubygems' | |
require 'bundler/setup' | |
require 'ffi-rzmq' | |
context = ZMQ::Context.new | |
puts "Starting Listener..." | |
listener = context.socket(ZMQ::SUB) | |
listener.setsockopt(ZMQ::SUBSCRIBE, '') |
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
source "http://rubygems.org" | |
gem "goliath" |
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 | |
# | |
# Get the commercial week of the current year. | |
# | |
require 'date' | |
puts Date.today.cweek |
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
function psgrep { | |
ps wwwaux | egrep "($1|%CPU)" | grep -v grep | |
} |
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
# Include me in your ActiveRecord model and get string attributes | |
# trimmed/stripped before validation. | |
module TrimStringAttributes | |
def self.included(base) | |
base.class_eval <<-EOF | |
before_validation :trim_string_attributes | |
EOF | |
end | |
protected |
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
# Want your Rails app to send all ActionMailer emails | |
# to a specific email adress instead of sending it | |
# to the world (e.g. in the staging environment)? | |
# | |
# Put this into e.g. config/environments/staging.rb | |
config.after_initialize do | |
module ::ActionMailer | |
class Base | |
class_eval do |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# | |
# boosty likes it like that: | |
# ~/dev/dir[master]$ # clean working directory | |
# ~/dev/dir[master⚡]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "⚡" | |
} |