Skip to content

Instantly share code, notes, and snippets.

View darrencauthon's full-sized avatar

Darren Cauthon darrencauthon

View GitHub Profile
@darrencauthon
darrencauthon / inherited.rb
Created May 10, 2012 18:26
Using inherited
class Object
@@list = []
def self.stuff
@@list
end
def self.inherited(base)
@@list << base
end
end
params = {}
params[:to] = "[email protected]"
params[:subject] = "xxx"
params[:from] = ""
@@params = params
# need to add gem smoke_monster for this
items = [:to, :team, :from_email].to_objects {
[:blue, :red, :white, :black, :orange, :green, :yellow, :pink, :test].map do |color|
@darrencauthon
darrencauthon / jquery.nodoubletapzoom.js
Created July 15, 2012 13:24 — forked from johan/jquery.nodoubletapzoom.js
A jQuery plugin to selectively disable the iOS double-tap-to-zoom action on specific page elements (and have that generate two click events instead).
// jQuery no-double-tap-zoom plugin
// Triple-licensed: Public Domain, MIT and WTFPL license - share and enjoy!
(function($) {
var IS_IOS = /iphone|ipad/i.test(navigator.userAgent);
$.fn.nodoubletapzoom = function() {
if (IS_IOS)
$(this).bind('touchstart', function preventZoom(e) {
var t2 = e.timeStamp
@darrencauthon
darrencauthon / Global.asax.cs
Created July 18, 2012 11:47
Register a new bin assembly loader with MVC Turbine
using MvcTurbine.ComponentModel;
using MvcTurbine.Unity;
using MvcTurbine.Web;
namespace MvcMusicStore
{
public class MvcApplication : TurbineApplication
{
static MvcApplication()
{
class SessionView < ViewModel
def speakers
@subject.speakers.map {|s| SpeakerView.new(s)}
end
def begin_date_only
@subject.begin.strftime("%B %-d, %Y")
end
def period
def current_club
club_id = current_member ? current_member.club_id : 1
@club ||= Club.find(club_id)
end
@darrencauthon
darrencauthon / gist:3709316
Created September 12, 2012 19:32 — forked from jmeirow/gist:3709299
Text parsing and mapping in Ruby
# the big picture... what data we're getting from where and its destination
@data_binding_hash = {
:@pSMSR_GRGR_ID=> [ :GRGR_ID, 'facets_field', DataType.STRING, DataSource.FACETS, '@pSMSR_GRGR_ID=""' , nil ],
:@pSMSR_SBSB_ID=> [ :SBSB_ID, 'facets_field', DataType.STRING, DataSource.FACETS, '@pSMSR_SBSB_ID=""' , nil ],
:@pSMSR_REL=> [ :patient_rel_code, 'rel_code', DataType.STRING, DataSource.LOOKUP, '@pSMSR_REL=""' , nil ],
:@pSMSR_SSN=> [ :MEME_SSN, 'facets_field', DataType.STRING, DataSource.FACETS, '@pSMSR_SSN=""' , nil ],
:@pSMSR_LNAME=> [ :SBSB_LAST_NAME, 'facets_field', DataType.STRING, DataSource.FACETS, '@pSMSR_LNAME=""' , nil ],
:@pSMSR_FNAME=> [ :SBSB_FIRST_NAME, 'facets_field',
@darrencauthon
darrencauthon / gist:3709530
Created September 12, 2012 20:09 — forked from jmeirow/gist:3709453
Ruby-style enums
class DataType
[:STRING, :DATE, :UNKNOWN, :NUMERIC].each do |type|
self.instance_eval "def self.#{type};:#{type};end"
end
end
@darrencauthon
darrencauthon / post.md
Created October 9, 2012 13:09
My arguments on SpecFlow regex versus static method names

Hi,

I just want to point out something with regards to supposed "duplication," which is:

##The method name does not matter.

For example, this step definition is perfectly valid:

[Given("I am writing a blog post")]

public void x(){

@darrencauthon
darrencauthon / gist:3872095
Created October 11, 2012 12:54
Five stages of database-driven programmer development

Five stages of database-driven development

1.) Denial: I'll build the perfect database to model the system!

2.) Anger: Argh, this is painful!

3.) Bargaining: I'll have to give-in and try something else here... (sshhhh, don't tell the others)

4.) Depression: The client changes keep coming!!!