================
If your language works like this by default..
var x = {a: 5};
var y = {a: 5};
x === y; // => false
================
If your language works like this by default..
var x = {a: 5};
var y = {a: 5};
x === y; // => false
var HighlanderJS = (function (immortals) { | |
var highlander = {}; | |
for (var immortal in immortals) { | |
highlander[immortal] = immortals[immortal]; | |
delete immortals[immortal]; | |
} | |
immortals.HighlanderJS = function (onlyOne) { | |
onlyOne.apply(highlander); | |
}; |
heapdump = require "heapdump" | |
Immutable = require "immutable" | |
pixels = 256 * 256 | |
iterations = 1000 | |
# Immutable | |
testImmutable = -> | |
# Simulate a pixel grid | |
grid = Immutable.Vector() |
✓ Bar
✓ A <p>Baz!</p> B
✓ <p>Foo</p> <script> a < b; </script> <span>Blam!</span>
✓ <p>Foo</p> <script type='text/javascript'> a < b || c > d; </script> <span>Blam!</span>
✓ D <p>Foo</p> <script type='text/javascript'>$('body').append('<' + 'script> a < b; <' + '/script>');</script> <span>Blam!</span> F <b>O</b>
module.exports = (grunt) -> | |
config = | |
browserify: | |
development: | |
options: | |
transform: ["coffeeify"] | |
debug: true | |
files: | |
"./public/scripts/editor.js": ["./frontend/scripts/editor.coffee"] | |
uglify: |
# Adjust device pixel ratio | |
setMaximumPixelRatio = (p_maximumRatio=1) -> | |
canvas = document.createElement('canvas') | |
context = canvas.getContext('2d') | |
devicePixelRatio = window.devicePixelRatio || 1 | |
backingStoreRatio = context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1 | |
pixelRatio = devicePixelRatio / backingStoreRatio | |
for className in ["HitCanvas", "SceneCanvas", "Canvas"] | |
Kinetic[className].prototype.init = ((p_method) -> (p_config={}) -> |
toRad = (p_angle) -> | |
return (p_angle - 90) * Math.PI / 180 | |
for method in ["drawArc", "drawRoundRect", "drawSlice"] | |
if PIXI.Graphics.prototype[method]? then console.warn "PixiJS already has an #{method} method defined. It's recommended that you update your code to use the official implementation." | |
PIXI.Graphics.prototype.drawArc = (p_x, p_y, p_radius, p_startAngle, p_endAngle) -> | |
totalAngle = p_endAngle - p_startAngle | |
segments = Math.ceil Math.abs(Math.sqrt(1 - Math.pow (1 - Math.min(p_radius / 60, 1)), 2) * totalAngle * p_radius * 0.01) | |
anglePerSegment = totalAngle / segments |
<head> | |
<!-- Rest of the <head> content here --> | |
<!-- Include jQuery --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<!-- Rest of the <body> content here --> |
# Create a deep copy of an object. - CoffeeScript conversion of @cederberg's deepClone implementation https://github.com/documentcloud/underscore/pull/595 | |
deepClone = (obj) -> | |
if !_.isObject(obj) or _.isFunction(obj) then return obj | |
if _.isDate obj then return new Date do obj.getTime | |
if _.isRegExp obj then return new RegExp obj.source, obj.toString().replace(/.*\//, "") | |
isArr = _.isArray obj or _.isArguments obj | |
func = (memo, value, key) -> | |
if isArr then memo.push deepClone value |
module = angular.module 'FacebookPluginDirectives', [] | |
createDirective = (name) -> | |
module.directive name, -> | |
restrict: 'C' | |
link: (scope, element, attributes) -> | |
FB?.XFBML.parse(element.parent()[0]) | |
createDirective pluginName for pluginName in ['fbActivity', 'fbComments', 'fbFacepile', 'fbLike', 'fbLikeBox', 'fbLiveStream', 'fbLoginButton', 'fbName', 'fbProfilePic', 'fbRecommendations'] |