Skip to content

Instantly share code, notes, and snippets.

View tjstankus's full-sized avatar

TJ Stankus tjstankus

  • Chapel Hill, NC
View GitHub Profile
@solnic
solnic / rom_mapper_and_anima.rb
Last active August 29, 2015 13:59
ROM mapper with anima model
require 'rom'
require 'anima'
class User
include Anima.new(:id, :name, :tasks)
end
class Task
include Anima.new(:title)
end
@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@IanWhitney
IanWhitney / links.md
Last active August 29, 2015 13:57
Reading material suggested during the Torquebox OOD class in Durham, 2014
@colinrymer
colinrymer / output
Last active December 19, 2015 01:59
using Ruby 1.9.3-p327-perf
$ ruby split_benchmark.rb
naive_regex
6.320000 0.130000 6.450000 ( 6.798818)
naive_squeeze
6.770000 0.070000 6.840000 ( 7.122865)
assigned_regex
5.710000 0.060000 5.770000 ( 5.869347)
assigned_squeeze
@avdi
avdi / life.rb
Created September 30, 2012 00:48
Game of Life, mildly functional version
#!/usr/bin/env ruby
# The game board, at one point in time
class BoardGeneration
# How an instance will build a copy with a new grid
def self.from_grid(grid)
allocate.tap do |bg|
bg.grid = grid
end
@tooky
tooky / card_creator.rb
Created July 6, 2012 20:52 — forked from gma/card_creator.rb
Moving response callbacks out of controller
class CardCreator < Struct.new(:listener)
def create(iteration, attributes)
card = iteration.cards.build(attributes)
if card.save
listener.created(card)
else
listener.create_failed(card)
end
end
end
@kopischke
kopischke / markdown2evernote.rb
Created June 5, 2011 16:57
OS X service scripts
#!/usr/bin/env ruby -wKU
# Adapted from Brett Terpstra’s original “Markdown to Evernote” service (http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/)
# Martin Kopischke 2011 – License: Creative Commons Attribution Share-Alike (CC BY-SA) 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)
# Changes: – create only one Evernote note per (Multi)Markdown input passed (instead of one per line)
# – do not choke on shell escape characters (use Tempfile instead of shell pipe for osascript)
# – default to MultiMarkdown 3 executable (instead of MMD 2 Perl script)
# – make smart typography processing optional (set SMARTY to 'false' to bypass processing;
# note smart typography cannot be disabled in MMD 3.0 and 3.0.1
# – handle both smart typography processing scripts (ie. SmartyPants.pl)