Skip to content

Instantly share code, notes, and snippets.

View winfred's full-sized avatar

Winfred Wolfgram winfred

View GitHub Profile
@winfred
winfred / simplysubscribe-me.html
Created April 18, 2012 08:13
SimplySubscribe.Me
<a href="#" class="simplysubscribe-button">Click here</a> to sign up to the newsletter.
<script type="text/javascript">
window.SimplySubscribeMeAsyncinit = function(){
new SimplySubscribeMe.SDK({
user_id: '5f96e5e279c0586e9576c5d88',
list_id: 'fa142cd2ad',
datacenter: 'us2',
signup_text: 'Subscribe',
button_selector: 'simplysubscribe-button'
});
@winfred
winfred / ruby-dot-hash-access.rb
Created March 24, 2012 17:28
Unobtrusive Ruby Hash dot access
class Hash
class NoKeyOrMethodError < NoMethodError; end
def method_missing(method,*args)
m = method.to_s
string_key = m.gsub(/=$/,'')
sym_key = string_key.to_sym
if self.has_key? string_key
m.match(/=$/) ? self.send("[#{string_key}]=", *args) : self[string_key]
elsif self.has_key? sym_key
m.match(/=$/) ? self.send("[#{sym_key}]=", *args) : self[sym_key]
@winfred
winfred / gist:1690862
Created January 27, 2012 20:52
An example .rvmrc file
#!/usr/bin/env bash
# This is an RVM Project .rvmrc file, used to automatically load the ruby
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
environment_id="ruby-1.9.2-p290@rails311"
#
# Uncomment following line if you want options to be set only for given project.