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
import json | |
def merge_polygons(polygon_one, polygon_two): | |
with open("data.json") as input: | |
data = json.load(input) | |
map_one = None | |
map_two = None |
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
# Rotate any jQuery selected element. | |
# Credit: https://gist.github.com/hoandang/5989980 | |
# Credit: https://stackoverflow.com/a/15191130/1544937 | |
$.fn.rotate = (degree = 0, duration = 1000) -> | |
element = $(this) | |
rotation = -> | |
matrix = element.css "-webkit-transform" or |
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
lower = (string) -> | |
return string.toLowerCase().trim() | |
upper = (string) -> | |
return string.toUpperCase().trim() | |
# Credit: https://stackoverflow.com/a/1026087/1544937 | |
capitalize = (string) -> |
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
# Info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty | |
# Info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number | |
# Source: https://gist.github.com/jgphilpott/6332dc7f5636db9ba455e1575407c496 | |
# Credit: https://stackoverflow.com/a/7312534/1544937 | |
Object.defineProperty Number.prototype, "round", | |
value: (decimals = 0) -> | |
parseFloat this.toFixed decimals |
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
# Requirements | |
# Three JS | |
# https://github.com/mrdoob/three.js | |
# OctreeCSG | |
# https://github.com/giladdarshan/OctreeCSG | |
morph = (operation, aMesh, bMesh) -> |
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
# Requirement: https://github.com/d3/d3 | |
# Credit: https://stackoverflow.com/a/42998001/1544937 | |
d3.selection.prototype.setAsFrontLayer = -> | |
return this.each -> | |
this.parentNode.appendChild this | |
d3.selection.prototype.setAsBackLayer = -> |
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
# Credit: https://stackoverflow.com/a/46181/1544937 | |
validEmail = (email = "@") -> | |
return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test String(email).toLowerCase() |
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
# Credit: https://stackoverflow.com/a/40246491/1544937 | |
getBrowser = -> | |
try | |
error.throw | |
catch error |
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
localKeys = -> | |
return Object.keys window.localStorage | |
localWrite = (key, value) -> | |
try | |
window.localStorage.setItem String(key), JSON.stringify(value) |
OlderNewer