Skip to content

Instantly share code, notes, and snippets.

@floehopper
floehopper / liquid-templates-and-date-formats.rb
Created July 24, 2024 12:36 — forked from chrisroos/liquid-templates-and-date-formats.rb
Playing with date formatting in liquid templates - Useful in Harmonia task titles
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'liquid'
end
require 'date'
require 'liquid'
@floehopper
floehopper / Gemfile
Last active August 29, 2015 14:23 — forked from chrisroos/Gemfile
source 'https://rubygems.org'
gem 'minitest'
gem 'webmock'
@floehopper
floehopper / atom.rb
Last active January 4, 2016 01:29 — forked from chrislo/gist:8543385
Evaluator for Little Schemer chapter 1
class Atom
attr_reader :symbol
def initialize(symbol)
@symbol = symbol
end
def ==(other)
self.symbol == other.symbol
end
@floehopper
floehopper / test.rb
Created January 30, 2011 17:08 — forked from benpickles/test.rb
require 'test/unit'
require 'rubygems'
require 'mocha'
class Foo
def self.say_hello_to(name)
Bar.hello(name)
end
end
module RaisableRedirections
def self.included(other)
other.send(:around_filter, :handle_raisable_redirections)
end
protected
def raise_redirect_to(*args)
raise Redirect.new(*args)
end
@floehopper
floehopper / gist:214172
Created October 20, 2009 10:20 — forked from technoweenie/gist:213780
how do you test algorithms?
# how do you test algorithms?
class Pythagoream < Struct.new(:a, :b)
def result
a**2 + b**2
end
end
# I prefer to "invert" the algorithm somehow
# or calculate the expected result another way.