Skip to content

Instantly share code, notes, and snippets.

View bittersweetryan's full-sized avatar

Ryan Anklam bittersweetryan

View GitHub Profile
var sub1 = new SubWidget( 'foo' );
var sub2 = new SubWidget( 'bar' );
sub1.messages.push( 'foo' );
sub2.messages.push( 'bar' );
var Widget = function( name ){
this.messages = [];
};
Widget.prototype.type='Widget';
var SubWidget = function( name ){
this.name = name;
Widget.apply( this, Array.prototype.slice.call( arguments ) );
};
var Widget = function(){
this.messages = [];
};
Widget.prototype.type='Widget';
var SubWidget = function( name ){
this.name = name;
var Foo = function(){};
Foo.prototype = new Bar();
var foo = new Foo();
foo.constructor === Foo; ///alse
var a = {
foo : function(){
console.log ( this );
var bar = function(){
console.log( this );
};
bar();
}
javascript:(function(){function e(){var b="";return d.each(function(a,c){b+=$(c).get(0).outerHTML}),b}function f(a){var b=a.text().split(" ");return b[b.length-1]}var d,a=$("#svPortal"),b=a.find("dl");document.createDocumentFragment(),d=b.sort(function(a,b){var c=$(a).find(".portalTitle>a"),d=$(b).find(".portalTitle>a");return c=f(c),d=f(d),console.log(c,d),d>c?-1:c>d?1:0}),a.html(e(d))})();
@bittersweetryan
bittersweetryan / Gruntfile.js
Created April 25, 2013 17:42
Grunt Handlebars Plugin Configuration to make the template the filename (minus extension) and put them in Hanlebars.templates.
handlebars: {
options: {
namespace : 'Handlebars.templates',
processName : function ( filename ){
var fileParts = filename.split('/');
return fileParts.slice( fileParts.length-1 )[0].split( '.' )[0];
}
},
compile: {
grunt.initConfig({
less: {
development : {
src : [ 'less/**/*.less' ],
dest : 'css/compiled-better.css'
;(function(){
var anchor = document.querySelectorAll( 'a' )[0],
span = document.querySelectorAll( 'span' )[0],
div = document.querySelectorAll( 'div' )[0];
div.addEventListener( 'click', function( e ){
console.log( e.target, e.currentTarget ); //anchor, div
e.preventDefault();
$(function(){
var div = $( '#doStuff' );
//add the delay to the queue
div.delay( 1000, 'myQ')
.queue( 'myQ', function(){
//this still refers to the current element
$( this ).prepend( '<p>Waited 1 second</p>' )
.find('p')