Skip to content

Instantly share code, notes, and snippets.

Scruggs not drugs

Norman Clarke norman

Scruggs not drugs
View GitHub Profile
View gist:851e1de4a1a575b7e2ef
According to my records your subscription will expire on 14 June 2014
LostCousins subscriptions are NOT renewed automatically unlike subscriptions for most other
genealogy sites - I prefer to depend on your generosity, not your forgetfulness.
The good news is that if you renew your subscription NOW it won't start until your existing
subscription expires - you'll get a full 12 months from the date shown above (so you don't have
to leave it until the last minute). Even better news is that the price hasn't changed since 2005 -
it's still just 10 pounds for a single subscription!
norman / pg.txt
Last active Aug 29, 2015
Optimal development-only Postgres settings for my Macbook Pro with 8GB RAM.
View pg.txt
# Add settings for extensions here
# Some stupid, dangerous settings only used to speed things up on a local
# development machine, where if data is lost I'll just wipe and recreate.
# Never ever ever use these in production or anything approximating
# production.
View gist:21b79a7024febb755b91
### Keybase proof
I hereby claim:
* I am norman on github.
* I am compay ( on keybase.
* I have a public key whose fingerprint is 3059 0FBA AFDE E001 D557 C63A 298B 0120 ED7D 0E39
To claim this, I am signing this object:
norman / gist:31643
Created Dec 3, 2008
AR monkeypatch to allow :order => :random
View gist:31643
module ActiveRecord
class Base
def self.add_order!(sql, order, scope = :auto)
scope = scope(:find) if :auto == scope
scoped_order = scope[:order] if scope
if order
sql << " ORDER BY #{connection.order(order)}"
norman / presenters-kit.en.textile
Created Jan 19, 2009
Presenter's Kit for the "Locos Por Rails" conference in Buenos Aires
View presenters-kit.en.textile
View gist:141646
local val = "hello world"
local env = getfenv()
local func = assert(loadstring("print(val)"))
setfenv(func, env)
-- expecting "hello world" but get "nil"
View gist:144664
require 'luarocks.require'
require 'rex'
require 'socket'
-- returns tag, id and classes
function parse_haml_tag_using_regex(str)
return rex.match(str, '(%[a-z0-9]*)?(#[a-z0-9-_]*)?(\.[a-z0-9-_\.]*)?')
-- returns tag, id and classes
View gist:284082
# ruby-1.9.1-p378
irb(main):009:0> "é".force_encoding("UTF-8") =~ /[\W]/u
=> 0
irb(main):010:0> "e".force_encoding("UTF-8") =~ /[\W]/u
=> nil
# ruby-1.9.1-p243
irb(main):006:0> "é".force_encoding("UTF-8") =~ /[\W]/u
=> nil
irb(main):007:0> "e".force_encoding("UTF-8") =~ /[\W]/u
View gist:294710
| AR |
find model using id x2000 | 1.264 |
find model using array of ids x2000 | 2.708 |
find unslugged model using friendly id x2000 | 1.954 |
find unslugged model using array of friendly ids x2000 | 2.829 |
find slugged model using friendly id x2000 | 3.305 |
find slugged model using array of friendly ids x2000 | 8.431 |
find cached slugged model using friendly id x2000 | 2.117 |
find cached slugged model using array of friendly ids x2000 | 3.178 |