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 'net/https' | |
class Sky | |
METHODS = [ :get, :post, :put, :delete ] | |
def initialize | |
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
# | |
# Load configuration files | |
# | |
Dir.chdir('config') | |
Dir.new('.').entries.each do |path| | |
if ! File.directory? path and File.size? path | |
puts 'Loading ' + path + '...' | |
YAML.load_file( path ).each do |param, value| | |
Cloudder.config. | |
send( File.basename( path, '.yml' ) ). |
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
# | |
# Cloud has many thoughts | |
# | |
@cld = Cloud.new('Earl') | |
## Get thought with title 'hello', belonging to cloud titled 'Earl' | |
t = @cld.thought 'hello' | |
# or | |
t = @cld.thought :title => 'hello' | |
# or |
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
NWORDS = Hash.new( 1 ) | |
File.new('holmes.txt').read.downcase.scan(/[a-z]+/) { |k| NWORDS[k] += 1 } | |
LETTERS = ("a".."z").to_a.join | |
def edits1 word | |
n = word.length | |
alteration = insertion = [] | |
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 String | |
def to_html | |
Prose.new(self).parse(false) | |
end | |
def to_html_lite | |
Prose.new(self).parse(true) | |
end | |
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
require 'json' | |
def metaclass; class << self; self; end; end | |
def meta_eval &blk; metaclass.instance_eval &blk; end | |
# Adds methods to a metaclass | |
def metadef name, &blk | |
meta_eval { define_method name, &blk } | |
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
// Global vars | |
@main-color: #444; | |
@dark-color: #111; | |
@between-color: @main-color - @dark-color; | |
// Mixins | |
.theme { | |
color: #ccc; | |
background-color: #aaa; | |
} |
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 'spec_helper' | |
Journey.map :Cow | |
module Cow | |
class Glass < Journey::Resource | |
def show id | |
["milk", @input["milk"], "glass", id].join '/' | |
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
@var: 9px; | |
#first { | |
height: 100%; | |
width: 50%; | |
#second { | |
color: blue; | |
#third { | |
display: block; | |
} |
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
grammar Less | |
rule ruleset | |
(ws selectors ws "{" ruleset "}" ws / declaration)+ <Descend> { | |
def build(env) super env, 1 end | |
} / | |
declaration* <Descend> { | |
def build(env) super env, 1 end | |
} | |
end | |
OlderNewer