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
deleteItem = (obj, item) -> | |
if Array.isArray obj | |
i for i, num in obj when num isnt item | |
else | |
newObject = {} | |
newObject[key] = obj[key] for key of obj when key isnt item | |
newObject |
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 -> | |
vendors = ['ms', 'moz', 'webkit', 'o'] | |
define 'requestAnimationFrame', ['root'], (root) -> | |
lastTime = 0 | |
{requestAnimationFrame} = root | |
unless requestAnimationFrame | |
for x in vendors | |
requestAnimationFrame = root["#{x}RequestAnimationFrame"] |
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
(** | |
* ArrayList.pas | |
* Provides a Java-/JavaScript-like generic class for handling a list of | |
* values | |
* | |
* This is free and unencumbered software released into the public domain. | |
* | |
* Anyone is free to copy, modify, publish, use, compile, sell, or | |
* distribute this software, either in source code form or as a compiled | |
* binary, for any purpose, commercial or non-commercial, and by any |
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
mixin = (target, source...) -> | |
return unless target or source | |
for s in source | |
for key, value of s | |
unless Object.hasOwnProperty.call target, key | |
console.log key | |
console.log value | |
target[key] = value | |
else |
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
define('vendors', function() { | |
return ['ms', 'moz', 'webkit', 'o']; | |
}); | |
define('requestAnimationFrame', ['root', 'vendors'], function(root, vendors) { | |
// frameRate is only used if requestAnimationFrame is not available | |
var frameRate = 60; | |
var requestAnimationFrame = root.requestAnimationFrame; |
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 ? window.eos or= {}) -> | |
root.each = (object, callback) -> | |
if Array.isArray object | |
callback key, value for value, key in object | |
else | |
callback key, value for own key, value of object | |
null | |
root.isEmptyObject = (object) -> Object.keys(object).length is 0 |
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 check' | |
root.ClassHelper = (object) -> | |
objPrototype = object:: | |
methods = | |
property: (prop) -> | |
for key, value of prop | |
propObject = |
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) -> | |
for key, value of prop | |
Object.defineProperty @prototype, key, value | |
Function::staticProperty = (prop) -> | |
for key, value of prop | |
Object.defineProperty @, key, value | |
class MyClass | |
privateVar = 5 |
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 -> | |
cache = {} | |
window.module = (name, defines) -> | |
return undefined unless name and defines | |
if typeof defines is 'function' then define = defines else {define, require, context} = defines | |
require = [] unless require? | |
context = @ unless context? |
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 (window = @) -> | |
cache = {} | |
window.module = (name) -> | |
deps = [] | |
requires = (dependencies) -> | |
deps = if Array.isArray dependencies then dependencies else [dependencies] | |
{requires, defines} |