Morgan Roderick mroderick

View buster.js
1 2 3 4 5 6 7 8 9 10
var config = module.exports;
config["browser"] = {
rootPath: "./",
environment: "browser",
sources: [
"dummy.js"
],
tests: [
"test-this-is-not-as-expected.js"
]
View refute.exception.js
1 2 3 4 5 6 7 8 9 10
/*jslint white:true, browser:true, plusplus:true */
/*global
FailFast,
buster,
assert,
refute
*/
 
(function(){
"use strict";
View Widget-example.html
1 2 3 4 5 6 7 8 9 10
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
var MyNameSpace = MyNameSpace || {};
(function(NS){
// private inside this closure
var ANY_OLD_CONSTANT = 'some constant value';
View this-function.js
1 2 3 4 5 6 7 8 9 10
var color = 'blue';
this.color = 'red';
 
console.log( color ); // blue
console.log( this.color ); // red
 
(function ( global ){
var color = 'green';
this.color = 'yellow';
View growing_file.js
1 2 3 4 5 6 7 8 9 10
/*
This is a response to a tweet by @felixge https://twitter.com/felixge/status/55402205695590400
I am sure there are errors and misunderstandings about what a Stream is, and what Stream.call expects.
My points here, were to make the code more readable by making the most of the fact that we can have containing scopes.
By using scopes within scopes, we get:
- exactly the desired methods on the constructor we want
- truly private variables and private functions
View screening.js
1 2 3 4 5 6
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
View screening.js
1 2 3 4 5 6
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
View es5array.js
1 2 3 4 5 6 7 8 9 10
/**
* Adds ECMA-262 rev. 5 methods to Array prototype, if they are missing
* Please note that the global prototypes are updated, so only use this file
* if that is acceptable, or if you're running in an iframe
*
* Please not that this file WILL NOT BE COPYRIGHTED, as it merely wraps mozilla implementation
* of JavaScript 1.6 / ECMA-262 rev. 5 methods
*
* @author Morgan Roderick - morgan@roderick.dk
*/
View test-case.js
1 2 3 4 5 6 7 8 9 10
/**
* TestCase for testing of ${1/\s.*//}
**/
var ${1:Name}Test = TestCase( "${1/\s.*//}Test", {
 
setUp : function(){
$2
},
tearDown : function(){
View setupNamespace.js
1 2 3 4 5 6 7 8 9 10
/**
Function for setting up namespaces.
@example
setupNamespace('my.cool.application.')´;
// will create a namespace my.cool.application
setupNamespace('my.cool.otherApplication');
// will create the my.cool.otherApplication namespace, without destroying the my.cool namespace
*/
function setupNamespace( namespace ) {
Something went wrong with that request. Please try again.