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
Scenario with magic | |
Given I use vim and tabular | |
When I cast a magic spell | |
Then I should see the following cukes: | |
| Latin | English | | |
| Cucumis sativus | Cucumber | | |
| Cucumis anguria | Burr Gherkin | |
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
io = File.open(...) | |
len = io.read(2).unpack("v")[0] | |
name = io.read(len) | |
width, height = io.read(8).unpack("VV") | |
puts "Rectangle #{name} is #{width} x #{height}" |
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 Rectangle < BinData::Record | |
endian :little | |
uint16 :len | |
string :name, :read_length => :len | |
uint32 :width | |
uint32 :height | |
end | |
io = File.open(...) | |
r = Rectangle.read(io) |
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 Names < BinData::Record | |
# non terminated fixed size string | |
string :fixed_size_name, :length => 6 | |
# string followed by a \0 | |
stringz :zero_terminated_name | |
# size stored before string | |
int8 :name_length | |
string :data, :read_length => :name_length |
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 MyItems | |
# This will read in only 3 ints | |
array :fixed_length_array, :initial_length => 3 do | |
uint8 | |
end | |
# This will read in each unit and pass it to the lambda until its value is 5 | |
array :variable_length_array, :read_until => lambda { element != 5 } do | |
uint8 | |
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
# Parse an NBT file (from Minecraft's map data) | |
class Compound < BinData::Record; end | |
class TagEnd < BinData::Record; end | |
class TagString < BinData::Record; end | |
class Payload < BinData::Record | |
int8 :tag_type | |
# This is very much like dealing with single table inheritance in ActiveRecord. |
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
body { | |
color: #eeeeec; | |
background-color: #888a85; | |
} | |
#header { | |
color: #eeeeec; | |
background-color: #3465a4; | |
padding: 16px; | |
margin: 16px 0; |
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 file reads in the current git branch and bases your database name on the rules you setup here | |
# if no output is given, use the capture from the select. | |
# if output given, lambda may access the matcher regex object, or just return a string | |
# match multiple branches, all share a db. | |
shared_db_for_all_cats: | |
select: ^(cat) | |
# match multiple, individual db | |
db_for_each_cat: |
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
source 'http://rubygems.org' | |
gem 'carmen' | |
gem 'carrierwave' | |
gem 'decent_exposure' | |
gem 'devise' | |
gem 'fabrication' | |
gem 'ffaker' | |
gem 'fog' | |
gem 'haml-rails' |
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
# Paperclip compliant class for uploading files through URL | |
# Simplified version of http://github.com/chris/paperclip_url_support | |
require "open-uri" | |
module Paperclip | |
class UrlTempfile < Tempfile | |
attr :content_type | |
def initialize(url) |