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
| (** | |
| * 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
| 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
| 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 (root = if exports? then exports else @) -> | |
| defined = [] | |
| modules = {} | |
| evaluateModules = (ids, callback, after) -> | |
| ids = [ids] if typeof deps is 'string' | |
| depList = [] | |
| depLength = ids.length |
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
| package ; | |
| /** | |
| * ... | |
| * @author Johannes Stein | |
| */ | |
| class EventMap | |
| { | |
| private var map: Map<String, Array<Dynamic -> Void>>; | |
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 nextTick = function(fn) { | |
| var id = window.requestAnimationFrame(function() { | |
| fn && fn(); | |
| window.cancelAnimationFrame(id); | |
| }); | |
| }; |
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 performance = window.performance; | |
| performance.now = performance.now || (function() { | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; | |
| var functionName = ''; | |
| for (var i = 0, j = vendors.length; i < j; i++) { | |
| functionName = vendors[i] + 'Now'; | |
| if (performance[functionName]) { | |
| return performance[functionName]; |
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 = @) -> | |
| root.mixinList = {} | |
| root.mixin = (target, name, params...) -> | |
| root.mixin(target, n, params) for n in name if Array.isArray name | |
| if typeof mixinList[name] is 'function' | |
| mixinList[name].apply(target, params) | |
| else | |
| target[key] = value for key, value of mixinList[name] when not Object.hasOwnProperty.call target, key |
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
| traverseObject = (o, key) -> | |
| keyArray = if key.indexOf('.') > 0 then key.split('.') else [key] | |
| for k in keyArray | |
| return unless Object.hasOwnProperty.call o, k | |
| o = o[k] | |
| o |