Skip to content

Instantly share code, notes, and snippets.

@igravious
igravious / endless.rb
Created October 10, 2011 13:35
Recursive lazy evaluated URLs
require 'rubygems'
require 'camping'
require 'lazy'
class Endless
include Enumerable
def initialize
make_a_promise Lazy.promise &Proc.new
end
@igravious
igravious / poetify.sql
Created October 25, 2011 13:35
Initial SQL table creation in Poetify
--
-- make sure that the Apache (Web Server) user or group has read/write
-- access to the sqlite file _and_ folder
--
DROP TABLE TreePaths;
DROP TABLE ePages;
DROP TABLE KindConstants;
--
@igravious
igravious / camping_hooks.rb
Created November 1, 2011 13:49
Generalized filters in Camping
#
# include the CampingHooks module in TheApp
#
module CampingHooks
module ClassMethods
def set_hook_key(k)
@hooks ||= {}
@hooks[k] ||= []
end
@igravious
igravious / html5_boilerplate.rb
Created November 1, 2011 22:55
html5 boilerplate say hello to markaby
# convert the index.html of html5 boilerplate to markaby
# html5 boilerplate repo: https://github.com/h5bp/html5-boilerplate
# needs HTML5 additions from my fork of markaby: https://github.com/igravious/markaby
def layout
comments = []
comments << '[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]'
@igravious
igravious / camping_migration.rb
Created June 13, 2012 19:30
Sexier migrations in Camping?
# put the following into safe_ar.rb our hack ar.rb or whatever takes your fancy
$SAFE_AR_EXTRAS = %{
# really, assumption is a terrible name
def self.schemify(assumption)
unless SchemaInfo.table_exists?
ActiveRecord::Schema.define do
create_table SchemaInfo.table_name do |t|
t.column :version, :float
# test/lib/triples_create_test.rb
require 'test_helper'
# assert_nil
# assert_equal
#
# http://guides.rubyonrails.org/testing.html
class CreateTriple < ActiveSupport::TestCase