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
# Ummm ... well. Just some pseudo code I guess. Fork + complete as needed. | |
# | |
# Dependencies: Kombucha culture is expected to be installed in ~/kitchen | |
# If you don't have one you can easily obtain one from the internet. | |
rails kombucha -m ~/homemade.rb | |
# ~/homemade.rb | |
system %( |
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
in terminal do: | |
defaults -currentHost write -globalDomain AppleFontSmoothing -int 2 |
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 -w | |
# mongo ;; 2010 (cc) Jan Riethmayer | |
# This work is licensend under a Creative Commons Attribution 3.0 license. | |
require 'optparse' | |
options = {} | |
optparse = OptionParser.new do|opts| | |
opts.banner = <<-BANNER | |
Usage: sudo ./mongo [options] |
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
# Assertion Method | |
def assert(value, message="Assertion failed") | |
raise Exception, message, caller unless value | |
end | |
options[:cowfile] and | |
assert(options[:cowfile].to_s !~ /^\s*$/) |
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
{}[:width] # => nil | |
{}[:width] || 40 # => 40 | |
{:width => nil}[:width] || 40 # => 40 | |
{:width => false}[:width] || 40 # => 40 | |
{:width => 29}[:width] || 40 # => 29 | |
{}.fetch(:width) # => | |
# ~> -:7:in `fetch': key not found (IndexError) | |
{}.fetch(:width) { 40 } # => 40 |
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
class NullObject | |
def initialize | |
@origin = caller.first | |
end | |
def method_missing(*args, &block) | |
self | |
end | |
def nil?; true; 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
# Method whose job is to raise or do nothing | |
def check_child_exit_status | |
result = yield | |
status = $? || OpenStruct.new(:exitstatus => 0) | |
unless [0,172].include?(status.exitstatus) | |
raise ArgumentError, | |
"Command exited with status #{status.exitstatus}" | |
end | |
result | |
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
# name_spec.rb ;; 2010 (cc) Jan Riethmayer | |
# This work is licensend under a Creative Commons Attribution 3.0 license. | |
require "spec_helper" | |
describe "Name" do | |
it "should contain all prefixes" do | |
Name.parts.each do |part| | |
Name.compute.any? do |name| | |
name.match(/^#{part.capitalize}/) | |
end.should == true |
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
# name.rb ;; 2010 (cc) Jan Riethmayer | |
# This work is licensend under a Creative Commons Attribution 3.0 license. | |
class Name | |
class << self | |
def parts | |
result = <<-NAMES | |
dev developer code arborium conservatory garden bit byte aid bot | |
open offen test behaviour mate rack ateer hash tree green grow | |
bloom karoshi flora keim flow forge former light nerds geeks rack | |
lab cultivation culture breed web mash restless awake less wheel |
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
(defun haml-mumamo-chunk (pos min max) | |
(mumamo-find-possible-chunk pos min max | |
'haml-mumamo-bw-exc-start-fun | |
'haml-mumamo-bw-exc-end-fun | |
'haml-mumamo-fw-exc-start-fun | |
'haml-mumamo-fw-exc-end-fun)) | |
(defun* haml-mumamo-exc-start-fun (pos lim max dir) | |
(if (or (null lim) (null max) (null pos)) (return)) | |
(flet ((check-lim () (when (> (point) max) (return)))) |
OlderNewer