This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.attributes({ | |
thing: html.attribute('data-thing'), | |
thong: null, | |
url: html.attribute('action') | |
}); | |
this.attr.thing | |
this.attr('thing'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<div id="test"> | |
<a href="" data-ref="bubo">Thingz</a> | |
<ul> | |
<li data-ref="lots" data-action="ponce">1</li> | |
<li data-ref="lots" data-action="mouseover:pants">2</li> | |
<li data-ref="lots" data-action="mouseover:pants">3</li> | |
<li data-ref="lots" data-action="mouseover:pants">4</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_chops = 16 | |
slice_length = sample_duration(:loop_amen_full) / num_chops | |
effects = [:distortion, :distortion, :slicer, :wobble] | |
define :play_slice do |slice| | |
if slice == 0 | |
start = 0 | |
else | |
start = (1.0 / num_chops) * slice | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Welcome to Sonic Pi v2.0 | |
use_bpm 140 | |
in_thread do | |
loop do | |
4.times do | |
3.times do | |
sample :ambi_choir, amp: 0.8 | |
sleep 2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.build(function(html) { | |
html.div( | |
html.a({ href: 'http://google.com' }, 'Click this link'), | |
html.span('Some text') | |
) | |
}).appendTo(body); | |
$.build(function(html) { | |
return html.div( | |
html.a({ href: 'http://google.com' }, 'Click this link'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DOM Builder plugin idea for jQuery | |
// | |
// Usage: | |
// $.build(function(html) { | |
// html.div({ id: 'test' }, html.strong('Some text')); | |
// }); => DOM fragment | |
// | |
(function($) { | |
flatten = function(arr) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Datafile | |
class << self | |
def glob(val) | |
@@globs ||= [] | |
@@globs << [glob, self] | |
end | |
def find(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
state :new, :default => true do | |
handle :queue! do | |
enqueue | |
transition_to :queued | |
save! | |
end | |
handle :fetch_ga_data! do | |
fetch_ga_data | |
extract_terms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
playlist = open('http://www.soundboard.com/playlist/REpFbW1hMjAwODQyMTQw_FjHigNpCqbI.xml') | |
doc = Hpricot::XML(playlist.read) | |
doc.search('//location').each do |node| | |
`curl -O #{node.inner_text}` | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.serializeHash = function() { | |
var arr = this.serialize(); | |
var hash = {}; | |
$.each(arr.split('&'), function(i, pair) { | |
var items = pair.split('='); | |
var key = unescape(items[0]), value = unescape(item[1]); | |
hash[key] = value; | |
}); |
OlderNewer