This file contains 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
// from http://roguebasin.roguelikedevelopment.org/index.php?title=Eligloscode | |
void FOV() | |
{ | |
float x,y; | |
int i; | |
CLEAR_MAP_TO_NOT_VISIBLE();//Initially set all tiles to not visible. | |
for(i=0;i<360;i++) | |
{ | |
x=cos((float)i*0.01745f); |
This file contains 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 memo = function (fn) { | |
var cache = {}, | |
toType = function(obj) { | |
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); | |
}; | |
return function () { | |
var key = [].join.call(arguments, '§') + '§'; | |
if (!(key in cache)) { | |
cache[key] = fn.apply(this, arguments); | |
} |
This file contains 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
// http://blog.mgechev.com/2013/01/21/functional-programming-with-javascript/ | |
/* By Stoyan Stafanov */ | |
function schonfinkelize(fn) { | |
var slice = Array.prototype.slice, | |
stored_args = slice.call(arguments, 1); | |
return function () { | |
var new_args = slice.call(arguments), | |
args = stored_args.concat(new_args); | |
return fn.apply(null, args); | |
}; |
This file contains 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 size = 10e6, // array size - the larger the better | |
// http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ | |
toType = function(obj) { | |
return ({}).toString.call(obj).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); | |
}, | |
// modify function used in loop peration | |
modifyFn = function(val) { | |
return val * 2; | |
}, | |
// caching initialisation result for repeated use |
This file contains 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 namespace = function namespace (packagesStr, context) { | |
var myContext = context || window, | |
packages = (packagesStr && typeof packagesStr === "string") ? packagesStr.split(".") : [], | |
create = function create (pkg, folders) { | |
if (pkg && typeof this[pkg] === "undefined") { | |
this[pkg] = {}; | |
} | |
if (folders && folders.length > 0) { | |
return create.call(this[pkg], folders.shift(), folders); | |
} |
This file contains 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
/* | |
Problem: how many collectible packets need to be bought to achieve a complete set, | |
when you don't know which one is in the packet. | |
i.e. There are 16 unique trading cards to complete a set. Each is sold in a sealed enclosing. | |
How many of them would it take to collect all 16? | |
answer: about 54! | |
https://plus.google.com/u/0/104223386721240823159/posts/goRYigJ4RGB | |
*/ | |
var countCollectibles = function (collectibleCount) { | |
var eulerConstant = 0.5772156649; |
This file contains 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 before = function(fn, pre) { | |
return function() { | |
pre.apply(this, arguments); | |
return fn.apply(this, arguments); | |
}; | |
}, | |
after = function(fn, aft) { | |
return function() { | |
var result = fn.apply(this, arguments); | |
aft.apply(this, result); |
This file contains 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
Array.prototype.shuffle = Array.prototype.shuffle || (function () { | |
function shuffle(array) { | |
var currentIndex = array.length | |
, temporaryValue | |
, randomIndex | |
; | |
// While there remain elements to shuffle... | |
while (0 !== currentIndex) { | |
This file contains 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
// DyRGS - dynamic responsive grid system | |
// @author: karsten.rieger@tritium-design.de | |
@gutter: 1.5625%; // ~= 10px gutter @ 320px width | |
@mobile-column-count: 4; | |
@tablet-column-count: 8; | |
@desktop-column-count: 12; | |
@mobile-selector: m; | |
@tablet-selector: t; | |
@desktop-selector: d; |
This file contains 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
// UMD dance - https://github.com/umdjs/umd | |
!function(root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
define(['jquery'], factory); | |
} else { | |
factory(root.jQuery); | |
} | |
}(this, function($) { | |
'use strict'; |
OlderNewer