Skip to content

Instantly share code, notes, and snippets.

View mferrier's full-sized avatar

Mike Ferrier mferrier

View GitHub Profile
@mferrier
mferrier / about.md
Last active August 29, 2015 14:06 — forked from antichris/about.md

Fork your own Gist

This is a bookmarklet that adds a fully functional Fork button to your own Gist.

If a Fork button is already present in the page, this bookmarklet will set focus to it instead of adding another one.

The change is temporary and the button will disappear as soon as you navigate away from that Gist (clicking the Fork button does this for you as well).


require 'rubygems'
require 'active_support'
# >> class Foo
# >> include LogMethodCalls
# >> log_methods :bar, :say, :one_plus, :do_something
# >>
# ?> def bar; puts "bar"; end
# >> def say(something); puts something; end
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
$ irb
>> if false
>> poop = true
>> end
=> nil
>> defined?(poop)
=> "local-variable"
>> poop
=> nil
ELEMENTPARSER DEBUG OUTPUT
2009-09-27 22:01:06.824 ljapp[96752:20b] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2009-09-27 22:01:06.825 ljapp[96752:20b]
2009-09-27 22:01:06.825 ljapp[96752:20b] <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
ELEMENTPARSER DEBUG OUTPUT
2009-09-27 22:01:06.824 ljapp[96752:20b] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2009-09-27 22:01:06.825 ljapp[96752:20b]
2009-09-27 22:01:06.825 ljapp[96752:20b] <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
ELEMENTPARSER DEBUG OUTPUT
2009-09-27 22:01:06.824 ljapp[96752:20b] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2009-09-27 22:01:06.825 ljapp[96752:20b]
2009-09-27 22:01:06.825 ljapp[96752:20b] <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
# Return the current path with its query parameters, merging the passed parameters over any existing ones
# Include an :exclude key to remove the named existing parameter keys before merging
#
# Examples:
#
# # From http://localhost:3000/ncaab
# current_path_with_merged_parameters(:offset => 1)
# => "/ncaab?offset=1"
#
# # From http://localhost:3000/ncaab?offset=1
>> date = Date.parse("nov 2, 2009")
=> Mon, 02 Nov 2009
>> start = Time.parse("2009-11-1T20:20")
=> Sun Nov 01 20:20:00 -0500 2009
>> start > date
=> true
<foo>
<bar></baz>