Skip to content

Instantly share code, notes, and snippets.

View nickh's full-sized avatar

Nick Hengeveld nickh

  • GitHub Staff
  • San Francisco, CA
View GitHub Profile
@nickh
nickh / set-list.md
Last active August 29, 2015 14:16
Specialty Set List
@nickh
nickh / notes.md
Created September 20, 2014 16:23
Notes: The Myth of a Christian Nation

Myth of a Christian Nation

Pre Thoughts

  • Christianity is a myth: there is only individual interpretations of what has been passed down, influenced by history and culture. It's not possible to say that one is the "right" version. (Also see The Myth of the Christian Religion.)
  • Myth that US was originally a religious nation vs a secular nation with freedom of thought populated by a high % of Christians.
  • Myth that Christianity now is the same as it was in the 1700s.
  • Myth that Christianity was ever intended to be a political force.
@nickh
nickh / herkimer.md
Created May 4, 2014 02:24
Herkimer the Knight

Herkimer the Knight

Sir Black was a dark and stormy knight. He was reigning in the kingdom of the white knights in Russia; his rival kingdom, Camelpot, was in a time of turmoil. Sir Black had sent some men over to try to take over, and everyone was suspicious of one another.

Back in the medieval ages when knights roamed the countryside and protected their castels, there lived a stableboy named Herkimer. He always dreamed of being a knight in shining armor and winning the heart of a fair maiden by slaying a dragon.

His dream was to be like his idol, Sir Billy, who was the greatest of all knights in the kingdom. Sir Billy's claim to fame was first for slaying FIREEYES, the most feared of all dragons, and second for causing the demise of SNARVLEY, the evil sorcerer who put a spell on the princess causing her to turn into a troll (Billy lifted the troll spell while he was at it, and the princess gave him 100 porcupines to show her gratitude). The third reason was the fact that he invented silly putty.

H

@nickh
nickh / irb.md
Created December 7, 2011 17:50
Class instance variables

Things and stuff

ruby-1.9.3-preview1 :015 > t1 = Thing.new
 => #<Thing:0x007fcaf104fa60> 
ruby-1.9.3-preview1 :016 > t2 = Thing.new
 => #<Thing:0x007fcaf2001008> 
ruby-1.9.3-preview1 :017 > t2.cache_some_stuff(:foo, 1)
 => 1 
ruby-1.9.3-preview1 :018 > Thing.instance_variable_get('@cached_stuff')

=> {:foo=>1}

@nickh
nickh / dynashard.rb.diff
Created August 5, 2011 21:42
Moar dynashard class generation fun
diff --git a/lib/dynashard.rb b/lib/dynashard.rb
index 9cdf095..e6ac9ac 100644
--- a/lib/dynashard.rb
+++ b/lib/dynashard.rb
@@ -264,15 +264,10 @@ module Dynashard
# Return a model subclass configured to use a specific shard
def self.sharded_model_class(shard_klass, base_klass)
- subclass_name = base_klass.dynashard_subclass_name
- class_name = "#{shard_klass.name}::#{subclass_name}"
@nickh
nickh / dynashard.rb.diff
Created August 5, 2011 17:42
Dynashard class generation cleanup
diff --git a/lib/dynashard.rb b/lib/dynashard.rb
index ef63584..220a47b 100644
--- a/lib/dynashard.rb
+++ b/lib/dynashard.rb
@@ -122,6 +122,53 @@
# - uniqueness validations should be scoped by whatever is sharding
module Dynashard
+ module GeneratedModelClass
+ extend ActiveSupport::Concern
@nickh
nickh / tracking_hash.rb
Created June 21, 2011 16:05
10 million collision-free 10-digit tracking hashes
require 'digest/sha1'
module TrackingHash
def tracking_hash
Digest::SHA1.hexdigest(known_collisions[self.id] || id.to_s)[0..9] unless self.id.nil?
end
private
def known_collisions
@nickh
nickh / autosave.diff
Created May 6, 2011 21:54
Autosave when moving between pages
diff --git a/app/views/messages/wizard.html.haml b/app/views/messages/wizard.html.haml
index f138222..1393a77 100644
--- a/app/views/messages/wizard.html.haml
+++ b/app/views/messages/wizard.html.haml
@@ -27,7 +27,6 @@
=link_to t('message.wizard.action.cancel'), '#'
=link_to t('message.wizard.action.back'), '#/back', :class => 'button back'
=link_to t('message.wizard.action.next'), '#/next', :class => 'button next'
- = f.submit 'save (TODO:removethis)'
@nickh
nickh / message.js
Created May 4, 2011 18:14
CKEditor + Backbone: play nicer
diff --git a/public/javascripts/app/views/messages/message.js b/public/javascrip
index ae6e29f..f6f5534 100644
--- a/public/javascripts/app/views/messages/message.js
+++ b/public/javascripts/app/views/messages/message.js
@@ -21,6 +21,10 @@ VR.Views.Messages.Components.Base = VR.Views.Base.extend({
},
validate: function( silent ) {
+ if ( this.beforeValidate ) {
+ this.beforeValidate();
@nickh
nickh / cruise_config.rb
Created November 5, 2010 18:35
Continuous deployment using CruiseControl.rb
# A deploy "build" designed to be triggered by a successful CI build
Project.configure do |project|
project.triggered_by = [SuccessfulBuildTrigger.new(project, 'orbital')]
project.build_command = '../cruise_deploy.sh'
end