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
| ### Keybase proof | |
| I hereby claim: | |
| * I am cjheath on github. | |
| * I am cjheath (https://keybase.io/cjheath) on keybase. | |
| * I have a public key whose fingerprint is B3B5 4A9F ADA5 DE58 DBBF 9EE0 44EB 9A2F 5B66 0046 | |
| To claim this, I am signing this object: |
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 Cell | |
| Directions = [ | |
| [-1,1], [0,1], [1,1], | |
| [-1,0], [1, 0], | |
| [-1,-1],[0,-1], [1,-1] | |
| ] | |
| # Where am I? | |
| def home | |
| [@x, @y] |
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
| s = 's'; | |
| def s.foo; 'foo'; end | |
| eigen = (class << s; self; end) | |
| def eigen.foo; 'bar'; end # This is unused | |
| def String.foo; 'baz'; end | |
| module Frob | |
| def foo |
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/ruby | |
| # | |
| # mved: Rename files from foo*bar to some*thing. | |
| # The "from" and "to" patterns must have one * or one ? each (escape it fron the shell) | |
| # | |
| # Author: Clifford Heath. | |
| # (c) Copyright 2013. | |
| # Free for any purpose, but don't claim you wrote it. | |
| require "getoptlong" |
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
| if ENV["RSPEC_REPORT_EXCEPTIONS"] | |
| class Exception | |
| alias_method :old_initialize, :initialize | |
| def self.exceptions_seen | |
| @@seen ||= {} | |
| end | |
| def self.see args | |
| stack = caller[1..-1] |
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
| #define OFFS -306 /* Offset to epoch-day (Day 1 is 1/1/0001) */ | |
| #define WD 0L /* Day of week offset */ | |
| /* | |
| * datol: takes a YMD date, and returns the number of days since some base | |
| * date (in the very distant past). | |
| * | |
| * Handy for getting date of x number of days before/after a given date. | |
| * A date is valid if ltodate() yields the same YMD you started with. | |
| * |
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
| $ sudo port install libusb | |
| ---> Fetching archive for libusb | |
| ---> Attempting to fetch libusb-1.0.9_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/libusb | |
| ---> Attempting to fetch libusb-1.0.9_0.darwin_11.x86_64.tbz2.rmd160 from http://packages.macports.org/libusb | |
| ---> Installing libusb @1.0.9_0 | |
| ---> Activating libusb @1.0.9_0 | |
| ---> Cleaning libusb | |
| ---> Updating database of binaries: 100.0% | |
| ---> Scanning binaries for linking errors: 100.0% | |
| ---> No broken files found. |
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 | |
| # | |
| # 1304046900 CONVERTS SVG TO RAPHAËL | |
| require "nokogiri" | |
| file = "world.svg" | |
| tree = Nokogiri::XML(File.open(file)) | |
| str = |
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
| require 'uuidtools' | |
| class User | |
| include DataMapper::Resource | |
| property :id, UUID, :key => true, :required => true, :default => proc { UUIDTools::UUID.random_create } | |
| has n, :projects | |
| has n, :deltas | |
| 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
| class Authentication | |
| include DataMapper::Resource | |
| belongs_to :user | |
| property :id, Serial | |
| property :user_id, Integer | |
| property :provider, String | |
| property :uid, String, :length => 240 | |
| property :user_name, String, :length => 240 | |
| property :user_email, String, :length => 240 |