This file contains hidden or 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
namespace = (name, func) -> | |
if name.indexOf('.') > 0 | |
nameArray = name.split('.') | |
else | |
nameArray = [name] | |
context = window | |
for i in nameArray | |
context = context[i] or= {} |
This file contains hidden or 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
((window, MilkSugar, $) -> | |
"use strict" | |
# Rebind method for JSHint | |
check = window.check | |
class MilkSugar.App | |
constructor: (assets = ['image', 'view']) -> | |
if assets? |
This file contains hidden or 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
do (root = exports ? this) -> | |
'use strict' | |
root.check = (variable, checkObject) -> | |
stringedVar = {}.toString.call variable | |
typeName = stringedVar.slice(8, stringedVar.length - 1).toLowerCase() | |
checkType = (typeString, cb, inverse) -> | |
if inverse |
This file contains hidden or 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
deepEquals = (objA, objB) -> | |
# Simplest of all checks | |
return true if (objA is objB) | |
# Both parameters need to be objects | |
return false if (typeof objA isnt 'object') or (typeof objB isnt 'object') | |
# Special case for Date objects | |
if (objA instanceof Date) or (objB instanceof Date) | |
return false if ((objA instanceof Date) isnt (objB instanceof Date)) or (objA.getTime isnt objB.getTime) |
This file contains hidden or 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
class Collection | |
data = | |
collection: {} | |
state: {} | |
proxies: | |
handler: {} | |
keyHandler: {} | |
contructor: (content) -> | |
if content |
This file contains hidden or 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
extend = (target, objects...) -> | |
for obj in objects | |
for key, value of obj | |
target[key] = value | |
target | |
# One object | |
a = extend {}, {test: 5} | |
alert JSON.stringify(a) |
This file contains hidden or 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 path = require('path'); | |
var fs = require('fs'); | |
var es6shim = require('es6-shim'); | |
/** | |
* dir: path to the directory to explore | |
* action(file, stat): called on each file or until an error occurs. file: path to the file. stat: stat of the file (retrived by fs.stat) | |
* done(err): called one time when the process is complete. err is undifined is everything was ok. the error that stopped the process otherwise | |
*/ | |
var walkFiles = function(dir, action, done) { |
This file contains hidden or 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
Function::property = (prop, desc) -> | |
Object.defineProperty @prototype, prop, desc | |
Function::staticProperty = (prop, desc) -> | |
Object.defineProperty @, prop, desc | |
class MyClass | |
privateVar = 5 | |
testVar = 10 |
This file contains hidden or 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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.ppu | |
*.dcu | |
*.so |
This file contains hidden or 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
# Packages # | |
############ | |
# it's better to unpack these files and commit the raw source | |
# git has its own built in compression methods | |
*.7z | |
*.dmg | |
*.gz | |
*.iso | |
*.jar | |
*.rar |