Skip to content

Instantly share code, notes, and snippets.

View jpcody's full-sized avatar

Joshua Cody jpcody

View GitHub Profile
/* Reused elements */
.button
background: url('../img/buttons.png')
display : block
height : 32px
text-indent : -9999px
width : 130px
&.download
background-position: -162px 0
/**
* QUESTION MAINTENANCE OPERATIONS
*
* This object contains the code to handle question maintenance. That includes, but is
* not limited to, switching to view administrative vs applicant questions, updating the
* qualification status of a given question, and selecting a new question to add.
*
*/
SM.adminQuestions = {
init : function(){
// the app uses javascript only for effects and the tiniest bit of data manipulation, so a
// full-stack framework doesn't necessarily make sense. I'm really looking to organize all
// of the effects we're doing throughout the app.
var NS = {};
NS.controllerName = {
init : function(){
this.doDomBindings();
// create a master object
var myObj = {};
myObj.nestedObj = {};
// create a nested object
myObj.nestedObj = {
myReturns : {
first : 'foo',
second : 'bar'
var myObj = {};
myObj.nestedObj = {
myReturns : {
first : 'foo',
second : 'bar'
},
myCaller : function(){
//used to have
var someObjOld = {
int1 : {},
int2 : {},
int3 : { function(){ this.int4(); }},
int4 : {}
};
// now have
var someObj = {
var someObj = {
// wtf? 2 names?
myFunc : function myAlias(){
// deep nesting
// deep nesting
// deep nesting
// deep nesting
// oh no, i need to call myself!
var _generateGroupId = function randGen(){
// 2. newid is reset
var newId = Math.floor(Math.random() * 10);
if( _(myArray).include(newId) ){
// 1. you're sent back to the top of the function
randGen.apply( this );
} else {
myArray.push( newId );
// 3. a new id is explicitly returned. if you log here, you will get the new value
// run this first on the console
var script= document.createElement('script');
script.src= 'https://raw.github.com/documentcloud/underscore/master/underscore-min.js';
document.head.appendChild(script);
// then run this
var someObj = {
$openDocument.click(function(e){
e.preventDefault();
this.showDocument( $(this) );
}.bind(this));