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
# This allows me to generate output as follows. | |
# | |
# For a DiceSet: | |
# | |
# <DiceSet: | |
# @set: [d8=>7, d10=>5, d12=>2, d8=>8, d6=>1] | |
# @results: {}> | |
# | |
# > d=Dice.instance | |
# > ds=DiceSet.new [d^8, d^10, d^12, d^8] |
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
CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195 |
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
%div#keypad | |
- (1..9).each do |i| | |
%div.button{:class => (i % 3 == 1) ? 'first' : ''}= i |
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 | |
require 'logger' | |
logfile = Time.now.strftime('%Y%m%d') | |
logfile = "/tmp/photo_sync_#{logfile}.log" | |
`touch #{logfile}` | |
$logger = Logger.new(logfile) | |
USER = 'matt' | |
class PhotoStream |
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
Psych::BadAlias (Unknown alias: test): | |
lib/labrador/adapter.rb:82:in `database_yml_config' | |
lib/labrador/adapter.rb:43:in `configuration' | |
lib/labrador/adapter.rb:102:in `valid?' | |
lib/labrador/app.rb:102:in `block in find_adapters_from_path' | |
lib/labrador/app.rb:96:in `each' | |
lib/labrador/app.rb:96:in `find_adapters_from_path' | |
lib/labrador/app.rb:84:in `initialize' | |
lib/labrador/app.rb:26:in `new' | |
lib/labrador/app.rb:26:in `block in find_all_from_path' |
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
# Using <<`EOC` in the manner lets you run a longer script from within Ruby easily. | |
print <<`EOC` | |
echo "This one is for the bitches" | |
echo "This ones is too" | |
EOC |
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
class A | |
def z | |
puts 'z' | |
end | |
end | |
module B | |
def z | |
puts "Z" | |
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
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
# == Synopsis | |
# Proof of concept using Fuzzy File Finder to locate a script to edit | |
# Searches a set of predefined locations for a fuzzy string | |
# e.g. "mwp" matches both "myweatherprogram" and "mowthelawnplease" | |
# ................on "(m)y(w)eather(p)rogram" and "(m)o(w)thelawn(p)lease" | |
# | |
# Results are ranked and a menu is displayed with the most likely | |
# match at the top. Editor to be launched and directories to search |
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
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |