Skip to content

Instantly share code, notes, and snippets.

View Yuffster's full-sized avatar
🕳️
ᕕ( ᐛ ) ᕗ

Michelle Steigerwalt Yuffster

🕳️
ᕕ( ᐛ ) ᕗ
View GitHub Profile
Eve.register('myAwesomePlugin', function() {
this.listen('a', 'click', function() {
console.log("You clicked on a link within my namespace!");
});
});
Eve.scope('#section-of-my-site', function() {
Eve.debug('myAwesomeModule');
Eve.register('myAwesomePlugin', function() {
this.listen('a', 'click', function() {
console.log("You clicked on a link within my namespace!");
});
});
Eve.attach('myAwesomePlugin', '#section-of-site');
Eve.scope('.image-slideshow', function() {
//Will return all .image-slideshow img items.
this.find('img');
this.listen('a', 'click', function() {
// Only returns img.active items within the current
// .image-slideshow element.
this.find('img.active');
@Yuffster
Yuffster / app.rb
Created May 26, 2012 09:39
Continuous Integration Server in < 20 Lines
require 'rubygems'
require 'sinatra'
require 'json'
require 'logger'
before do
#only allow access to GitHub.
ips = ['207.97.227.253', '50.57.128.197', '108.171.174.178'];
halt 404, "D:&lt;" unless ips.find_index(@env['REMOTE_ADDR'])>=0
end
@Yuffster
Yuffster / .gitignore
Created July 16, 2012 08:57
Spanish homework study helper
./node_modules
@Yuffster
Yuffster / Element.Data.js
Created July 25, 2012 05:48
Data attribute API extension for MooTools.
Element.implement({
getData: function() {
var data = {}, attrs = this.attributes;
for (var i=0; i<attrs.length; i++){
k = attrs.item(i).nodeName;
if (k.match(/^data-/)) data[k.replace(/^data-/, '')] = attrs.item(i).nodeValue;
} return data;
},
@Yuffster
Yuffster / jquery-spy.js
Created October 2, 2012 06:45
Spy on jQuery event handlers to figure out what line of JS attached a called event
(function() {
var on = $.fn.on;
$.fn.on = function() {
var args=[], line = new Error().stack.split('\n')[1], fn=arguments[arguments.length-1];
for (var i=0;i<arguments.length;i++) args[i] = arguments[i];
args[args.length-1] = function() { console.log(line); return fn.apply(this, args); };
on.apply(this, args);
return this;
};
})();
(function fizzBuzz(n) {
var rules = {3: 'Fizz', 5: 'Buzz'}, x, str = '';
for (x in rules) if (!(n%x)) str += rules[x];
return ((--n>0) ? fizzBuzz(n) : '') + (str || ++n) + '\n';
})(100);
class CrudController < ApplicationController
# GET /<models>
# GET /<models>.json
def index
respond_with call_on_model(:scoped)
end
# GET /<models>/1
# GET /<models>/1.json