This file contains 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
ioc('parent', function(component, parentElement){ | |
parentElement.click(function() { | |
component.parentClicked(); | |
}); | |
}); | |
ioc('component', function(componentElement) { | |
componentElement.click(function() { | |
alert('component clicked'); | |
}); |
This file contains 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
ioc.register('parent', function(child, sampleDomElement) { | |
return { | |
sayHello: function() { | |
sampleDomElement.innerHTML = '<h1>Hi There</h1>'; | |
child.doIt(sampleDomElement); | |
} | |
}; | |
}); | |
ioc.register('child', function() { |
This file contains 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
get('/', function() { | |
var self = this; | |
articleProvider.findAll(function(error, docs) { | |
jade.renderFile('./views/blogs_index.html.jade', { | |
locals: { | |
title: 'Blog', | |
articles: docs | |
} | |
}, |
This file contains 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
context('a context tester', function() { | |
var result; | |
this.when('when async', function() { | |
var self = this; | |
sys.puts('starting async'); | |
setTimeout(function() { | |
sys.puts('2 seconds later'); | |
result = 2; | |
self.done(); |
This file contains 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
app.use(connect.compiler({ | |
src: pub, | |
enable: ['scss', 'sass'], | |
compilers: [{ name: 'scss', compiler: require('scss/compiler') }] | |
})); |
This file contains 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
// Implementation | |
var iter = function(obj, callback) { | |
Object.keys(obj).forEach(function(key) { | |
callback(key, obj[key]); | |
}); | |
}; | |
// Usage | |
iter(obj, function(name, val) { | |
// Do shit here |
This file contains 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
var generateUniqueId = function(post) { | |
return [ | |
'tag:brianmavity.com,', | |
post.publishDate.slice(0, 10), | |
':/blog/', | |
post.publishDate.replace(/T|Z|\.|:|-/g, '') | |
]; | |
}; | |
doc( |
This file contains 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
doc( | |
'<!DOCTYPE html>', | |
html( | |
head( | |
title('Software Development, Interaction Design'), | |
link({ rel: 'alternate', href: 'http://feeds.feedburner.com/brianmavitycomblog', type:'application/atom+xml', title: 'brianmavity.com - Atom' }), | |
link({ rel: 'stylesheet', href: '/css/reset.css', type: 'text/css', media: 'screen' }), | |
link({ rel: 'stylesheet', href: '/css/vertical-rhythm.css', type: 'text/css', media: 'screen' }), |
This file contains 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
//HaloGame has the title of a particular halo release | |
HaloGame = new Array("Halo", "Halo 2", "Halo 3", "Halo: ODST", "Halo: Reach"); | |
var haloYearDifferences = new Array (0, 3, 6, 8, 9); | |
var halo2YearDifferences = new Array (3, 0, 3, 5, 6); | |
var halo3YearDifferences = new Array (6, 3, 0, 2, 3); | |
var haloOdstYearDifferences = new Array (8, 5, 2, 0, 1); | |
var haloReachYearDifferences = new Array (9, 6, 3, 1, 0); | |
//creating a 2-dimensional array of years between releases |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Sample Page for Module Intro</title> | |
</head> | |
<body> | |
<h1>Variables added to window object</h1> | |
<script src="samplePageExternal.js"></script> | |
<script> | |
// For IE. You've brought the alert punishment on yourself. ;) |
OlderNewer