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 DeferrableBlock | |
attr_reader :deferred | |
attr_reader :binding | |
def initialize(block, binding=nil) | |
@code = block | |
@binding = binding || Kernel.binding | |
@deferred = false | |
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 'yaml' | |
class YAMLHash | |
def reload | |
raise 'File not found' if !File.exists?(@filename) | |
@data = YAML::load(File.open(@filename)) | |
end | |
def initialize(*filename) |
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
<p> with amazonPaymentsAccounId </p> | |
<form method="post" action="https://authorize.payments-sandbox.amazon.com/pba/paypipeline"> | |
<input type="hidden" value="11SEM03K88SD016FS1G2" name="accessKey"> | |
<input type="hidden" value="315.0" name="amount"> | |
<input type="hidden" value="Invoice #1 from Opus Video Productions" name="description"> | |
<input type="hidden" value="EwhxireJt/0G1keEvy773ldIdOWB4EyIPkJOXbzeyvk=" name="signature"> | |
<input type="hidden" value="HmacSHA256" name="signatureMethod"> | |
<input type="hidden" value="2" name="signatureVersion"> | |
<input type="hidden" value="EMZXSGCRFEZL3DGZ625KKGGQBTDPJ26F6ZCNQ3" name="amazonPaymentsAccountId"> | |
<input type="hidden" value="http://0.0.0.0:3000/payment_cancelled" name="abandonUrl"> |
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
def update_quality(items) | |
rules = { "Conjured" => { ds:-1, mq:50, dq:[ -4, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 ]}, | |
"Sulfuras" => { ds: 0, mq:80, dq:[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]}, | |
"Aged Brie" => { ds:-1, mq:50, dq:[ +2, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1, +1 ]}, | |
"Backstage" => { ds:-1, mq:50, dq:[-50, +3, +3, +3, +3, +3, +2, +2, +2, +2, +2, +1 ]}, | |
"." => { ds:-1, mq:50, dq:[ -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ]}} | |
items.each do |item| | |
rules.each do |key,rule| | |
if item.name=~/#{key}/ | |
item.quality += rule[:dq][ [0, item.sell_in, 11].sort[1] ] |
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 Particle | |
attr :x | |
attr :y | |
attr :state | |
def initialize(field, values = {}) | |
@field = field | |
@state = values[:state] || '.' | |
@next_state = @state | |
@x = values[:x] || rand(@field.size) |
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
{--- Circa 1989 ---} | |
unit ddansi; | |
interface | |
uses dos, crt; | |
{----------------------------------------------------------------------------} | |
{ Ansi screen emulation routines } | |
{ By Scott Baker } |
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 FileSlice < File | |
def limit(lower,upper) | |
@lower = lower | |
@upper = upper | |
@offset = @lower | |
rewind | |
end | |
def rewind |
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
function who_wrote_this_code { find $1 \( ! -regex '.*/\..*' \) -name '*.rb' -type f -print -exec git blame '{}' \; | ruby -pe "sub /(^.*\((.*?)\s+2.*$)/, '\2'" | egrep -vE '[[:punct:][:digit:]]' | sort | uniq -c | sort -nr; } |
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
// Github Gists | |
// https://github.com/condemil/Gist | |
{ "keys": ["control+g", "g"], "command": "gist" }, | |
{ "keys": ["control+g", "p"], "command": "gist_private" }, | |
{ "keys": ["control+g", "u"], "command": "gist_update_file" }, | |
{ "keys": ["control+g", "l"], "command": "gist_list" }, | |
{ "keys": ["control+g", "i"], "command": "insert_gist_list" }, | |
{ "keys": ["control+g", "a"], "command": "gist_add_file" }, |
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
Show hidden characters
// Github | |
// https://github.com/temochka/sublime-text-2-github-tools | |
{ "keys": ["control+g", "g"], "command": "public_gist_from_selection" }, | |
{ "keys": ["control+g", "p"], "command": "private_gist_from_selection" }, | |
{ "keys": ["control+g", "u"], "command": "open_gist_url" }, | |
{ "keys": ["control+g", "o"], "command": "open_gist_in_editor" }, |
OlderNewer