This file contains hidden or 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
# git lye | |
# An attempt to make rebasing easy, by draining unnessarcy commit noise. | |
# No warranty, use at own risk. | |
# Author Hannes Tydén <[email protected]> | |
# Contributor Tobias Schmidt <[email protected]> | |
# TODO | |
# - Don't sign off all commits are by current user. |
This file contains hidden or 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
module EventMachine | |
class StderrHandler < EventMachine::Connection | |
def initialize(connection) | |
@connection = connection | |
end | |
def receive_data(data) | |
@connection.receive_stderr(data) | |
end | |
end |
This file contains hidden or 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 echo (str) { | |
return str | |
} | |
echo("Hello") | |
(function() { | |
echo("Goodbye") | |
}) |
This file contains hidden or 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 an anonymous module | |
# | |
# Useful for defining a class with a base module. So, instead of: | |
# | |
# class Foo | |
# module Base | |
# def bar | |
# # ... | |
# end | |
# end |
This file contains hidden or 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
# request.port is unfortunately useless from within the app, as it | |
# does not reflect the backend bind port, but the frontend proxy. | |
# So we have to reverse lookup the PID to figure out our port. | |
def backend_server_port | |
Thread.current[:backend_server_port] ||= begin | |
logger.debug "Attempting to reverse-lookup server port from PID file" | |
port = nil | |
Dir["#{RAILS_ROOT}/tmp/pids/thin.*.pid"].each do |f| | |
pid = File.read(f).chomp.to_i | |
if pid == $$ |
This file contains hidden or 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 | |
def find_deps(cookbook_dir) | |
nel = Hash.new { |h, k| h[k] = [] } | |
Dir.glob("#{cookbook_dir}/*/").each do |r| | |
deps_for(r, nel) | |
end | |
nel | |
end |
This file contains hidden or 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://yehudakatz.com/2010/02/21/ruby-is-not-a-callable-oriented-language/ | |
module DoAsYouPlease | |
Object.send :include, self | |
def method_missing(name, *args, &block) | |
self.class.const_get(name).call(*args, &block) | |
end | |
end | |
Foo = proc { 42 } |
NewerOlder