Skip to content

Instantly share code, notes, and snippets.

View cloudhead's full-sized avatar
🌴
On vacation

Alexis Sellier cloudhead

🌴
On vacation
View GitHub Profile
require 'net/https'
class Sky
METHODS = [ :get, :post, :put, :delete ]
def initialize
end
#
# 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' ) ).
#
# 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
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 = []
class String
def to_html
Prose.new(self).parse(false)
end
def to_html_lite
Prose.new(self).parse(true)
end
end
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
// Global vars
@main-color: #444;
@dark-color: #111;
@between-color: @main-color - @dark-color;
// Mixins
.theme {
color: #ccc;
background-color: #aaa;
}
require 'spec_helper'
Journey.map :Cow
module Cow
class Glass < Journey::Resource
def show id
["milk", @input["milk"], "glass", id].join '/'
end
@var: 9px;
#first {
height: 100%;
width: 50%;
#second {
color: blue;
#third {
display: block;
}
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