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
module MyMixin | |
def test_constant | |
puts MY_CONSTANT | |
end | |
end | |
class Foo | |
MY_CONSTANT = "BLAH" | |
include MyMixin | |
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
module MyMixin | |
def self.included(base) | |
puts base.to_s | |
end | |
end | |
module TopLevel | |
class MyClass | |
include MyMixin | |
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
require "jruby" | |
require "dcell" | |
DCell.start id: "node1-client", addr: "tcp://127.0.0.1:4001", directory: {id: "node1", addr: "tcp://127.0.0.1:4000"} | |
loop { | |
duck = DCell::Global[:duck] | |
if duck | |
begin | |
puts duck.future.quack.value(1.5) |
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
module MTData | |
class Base < ActiveRecord::Base | |
# MT_DATA_DATABASE should have a connection string to one of the | |
# specific databases. | |
establish_connection MT_DATA_DATABASE | |
end | |
class Street < Base | |
self.table_name = "street" | |
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 Autocompleter | |
def self.parse_street_input(input) | |
matches = / | |
( | |
(?:[Uu](?:nit)?\s*)? #U or Unit, any casing, maybe with following spaces, non-captured | |
[\d\/\s\\\-,]+ #Unit number (Digits, spaces, dashes, both slashes) | |
\d?) #Street Number | |
?\s? #Spacing and Optionality for Numbering | |
([\w\-\s']+) #Street Name - Match any combination of words and spaces (And apostrophe) |
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 "dalli" | |
require "yaml" | |
module MTDataStone | |
class CachableAddresses < Addresses | |
DALLI_HOST = "localhost:11211" | |
DALLI_OPTIONS = {} | |
EXPIRY_PERIOD = 60.days | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<!-- IF PEN IS PRIVATE --> | |
<!-- <meta name="robots" content="noindex"> --> | |
<!-- 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
-- SELECT with LIMIT and OFFSET in MySQL | |
SELECT id, name FROM table ORDER BY name LIMIT 100 OFFSET 50; | |
-- SELECT with LIMIT and OFFSET in Oracle | |
SELECT a.id, a.name | |
FROM (SELECT b.id, b.name, |
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
# Usage: redis-cli publish message hello | |
require 'sinatra' | |
require 'redis' | |
conns = [] | |
get '/' do | |
erb :index | |
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
<ManualJournal> | |
<Date>2011-12-31</Date> | |
<Status>DRAFT</Status> | |
<LineAmountTypes>Exclusive</LineAmountTypes> | |
<UpdatedDateUTC>2008-09-12T05:04:00</UpdatedDateUTC> | |
<ManualJournalID>f00a355b-7374-445c-886b-0437bea4095c</ManualJournalID> | |
<Narration>Computer expenses incorrectly coded</Narration> | |
<JournalLines> | |
<JournalLine> | |
<Description>Laptop to wrong expense account</Description> |