Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Springett paulspringett

View GitHub Profile
View liquid.rb
tmpl = Liquid::Template.parse("I've just liked @{{idea_owner}} idea on Rusic at {{link}}")
tmpl.root.nodelist
=> ["I've just liked @", #<Liquid::Variable:0x10301f050 @filters=[], @name="idea_owner", @markup="idea_owner">, " idea on Rusic at ", #<Liquid::Variable:0x10301ed80 @filters=[], @name="link", @markup="link">]
@paulspringett
paulspringett / pow.sh
Created Jul 6, 2011
Bash shortcut to create Pow! symlink for current directory
View pow.sh
# add this to your .bash_profile
function pow() {
name=`basename $PWD`
if [[ $1 && $1 != "-ru" ]]; then
name=$1
fi
echo "Using name: $name"
@paulspringett
paulspringett / gist:1016532
Created Jun 9, 2011
Streamsend ActiveResource fix
View gist:1016532
class Streamsend::Blast < ActiveResource::Base
self.site = "https://app.streamsend.com/"
self.user = "{login_id}"
self.password = "{key}"
self.element_name = "blast"
private
# fix because streamsend rarely includes the type="array" attribute
View cucumber.sh
gem install cucumber webrat
./script/generate cucumber --test-unit
View sha1_digest.rb
require 'digest/sha1'
sha1 = Digest::SHA1.hexdigest('something secret')
@paulspringett
paulspringett / jquery.dataset.js
Created Jul 21, 2010
Plugin to allow easy read/write access to HTML5 data- attributes
View jquery.dataset.js
$.fn.dataset = function(key, value) {
if(value != null) {
if($(this).attr('data-' + key)) {
$(this).attr('data-' + key, value);
return true;
} else {
return false;
}
} else {
return $(this).attr('data-' + key);