This file contains hidden or 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
| 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() { |
This file contains hidden or 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
| Eve.debug('myAwesomeModule'); |
This file contains hidden or 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
| 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'); |
This file contains hidden or 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
| 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'); |
This file contains hidden or 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 '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:<" unless ips.find_index(@env['REMOTE_ADDR'])>=0 | |
| end |
This file contains hidden or 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
| ./node_modules |
This file contains hidden or 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
| 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; | |
| }, | |
This file contains hidden or 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
| (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; | |
| }; | |
| })(); |
This file contains hidden or 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
| (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); |
This file contains hidden or 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 CrudController < ApplicationController | |
| # GET /<models> | |
| # GET /<models>.json | |
| def index | |
| respond_with call_on_model(:scoped) | |
| end | |
| # GET /<models>/1 | |
| # GET /<models>/1.json |