Skip to content

Instantly share code, notes, and snippets.

View codylindley's full-sized avatar

Cody Lindley codylindley

View GitHub Profile
//document own properties
console.log(Object.keys(document).sort());
//document own properties & inherited properties
var documentPropertiesIncludeInherited = [];
for(var p in document) { documentPropertiesIncludeInherited.push(p); }
console.log(documentPropertiesIncludeInherited.sort());
//document inherited properties only
var documentPropertiesOnlyInherited = [];
@codylindley
codylindley / index.html
Last active February 3, 2017 18:12
VPXKgJ
<strong>test</strong>
var myModel = new Backbone.Model(attributes, {options}, anything-else-passed-to-initialize-function);
/*
attributes = {data:value, data:value} or [value,value]
options = {
collection: {},
url: '',
urlRoot: '',
parse: boolean
}
$(document).ready(function() {
$('.inviteToGroupBtn').on('click', function() {
lightboxAJAX('/lightbox/invite_to_group?lightbox=1&group_id='+$(this).data('group-id'));
});
$('.usergroupCTA').on('click', function() {
var $this = $(this);
<script>
var dojoConfig = {
async:true,
cacheBust:new Date(),
waitSeconds:5
};
</script>
<script src="path/to/dojo/dojo.js"></script>
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*<%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %>\n' + '<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
qunit: {
<div data-dojo-type="dojo.data.ItemFileReadStore" data-dojo-id="continentStore"
data-dojo-props="url:'{{dataUrl}}/dijit/tests/_data/countries.json'"></div>
<div data-dojo-type="dijit.tree.ForestStoreModel" data-dojo-id="continentModel"
data-dojo-props="store:continentStore, query:{type:'continent'},
rootId:'continentRoot', rootLabel:'Continents', childrenAttrs:'children'"></div>
<div data-dojo-type="dijit.Tree" id="mytree"
data-dojo-props="model:continentModel, openOnClick:true">
<script type="dojo/method" data-dojo-event="onClick" data-dojo-args="item">
alert("Execute of node " + continentStore.getLabel(item)
@codylindley
codylindley / gist:2047418
Created March 15, 2012 22:40
Track Clicks
trackIt: function(p,callback,evil){
//mpg window.mpq.track(label,params{ });
//gaq window._gaq.push('_trackEvent',category,action,label,value);
var g = false, m = false;
var yesCallback = arguments[1] !== undefined && typeof arguments[1] === 'function';
//window._gaq.push('_trackEvent',p.category,p.action,p.label,p.value);
window._gaq.push(['_trackEvent',p.category,p.action,p.label,p.value]);
@codylindley
codylindley / gist:2033972
Created March 14, 2012 04:02
Find limit of recursion
var recurse = function(depth){
try{
return recurse(depth + 1);
}catch(ex){
return depth;
}
};
console.log(recurse(1));
var message = 'Spoon!';
$('#foo').bind('click', {msg: message}, function(event) {
alert(event.data.msg);
});
message = 'Not in the face!';
$('#bar').bind('click', {msg: message}, function(event) {
alert(event.data.msg);
});