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
/** | |
* @author zz85 / https://github.com/zz85 | |
* Parametric Surfaces Geometry | |
* based on the brilliant article by @prideout http://prideout.net/blog/?p=44 | |
* | |
* new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements ); | |
* | |
*/ | |
THREE.ParametricGeometry2 = function ( func, slices, stacks ) { |
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
/* | |
* @author zz85 / https://github.com/zz85 | |
* | |
* Related Readings | |
* | |
* http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ | |
* http://www.sunsetlakesoftware.com/2013/10/21/optimizing-gaussian-blurs-mobile-gpu | |
* http://xissburg.com/faster-gaussian-blur-in-glsl/ | |
* https://github.com/manuelbua/blur-ninja | |
* |
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
if (!document.styleSheets.length) document.head.appendChild(document.createElement('style')); | |
var sheet = document.styleSheets[document.styleSheets.length - 1]; | |
var rules = {}; | |
function cssRule(selector, styles) { | |
var index; | |
if (selector in rules) { | |
index = rules[selector]; | |
sheet.deleteRule(index); | |
} else { | |
index = rules[selector] = sheet.cssRules.length; |
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
function format_numbers(n) { | |
return (n / 1024 / 1024).toFixed(3) + 'MB'; | |
} | |
function mem() { | |
if (performance && performance.memory) { | |
console.log('used heap', format_numbers(performance.memory.usedJSHeapSize)) | |
console.log('total heap', format_numbers(performance.memory.totalJSHeapSize)) | |
console.log('heap limit', format_numbers(performance.memory.jsHeapSizeLimit)) | |
} |
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
function Histogram() { | |
this.reset(); | |
} | |
Histogram.prototype.reset = function() { | |
this.counts = []; | |
this.types = {}; | |
}; |
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 c = document.createElement('canvas'); | |
c.width = innerWidth; | |
c.height = innerHeight; | |
var ctx = c.getContext('2d'); | |
document.body.appendChild(c); | |
var last = performance.now(); | |
var delay = 0; |
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
// TODO Use the DOM Mutation API! | |
(function switchText(node) { | |
var nodes = node.childNodes; | |
for (var n = 0; n < nodes.length; n++) { | |
if (nodes[n].nodeName.match(/(script|style)/i)); else | |
if (nodes[n].nodeType == 3) { | |
if (!/^\s+$/.test(nodes[n].value)) { | |
nodes[n].data = nodes[n].data.replace(/[a-zA-Z]+/g, function(w) { | |
return (w.match(/^(the|on|are|if|is|and|or|you|your|a|an)$/i)) | |
? w |
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
function stretch(args) { | |
for (var i = 0, il = args.length; i<il; i++) { | |
var c = args[i]; | |
args[i] += new Array(200).slice(c.length).join(' '); | |
} | |
return 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
<html> | |
<head> | |
<script> | |
GSS_CONFIG = { | |
worker: "bower_components/gss/dist/worker.js", | |
verticalScroll: !false | |
}; | |
// also see https://raygun.io/blog/2014/06/next-gen-constraint-layouts-browser-grid-style-sheets/ |
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
body { | |
} |
OlderNewer