This file describes de required Style Guide used by Basicamente to keep the Best Practices on develop new features or improve/change existents one.
Always follow the folder structure below:
src/
<canvas id="canvas"></canvas> | |
<!-- | |
for most samples webgl-utils only provides shader compiling/linking and | |
canvas resizing because why clutter the examples with code that's the same in every sample. | |
See https://webglfundamentals.org/webgl/lessons/webgl-boilerplate.html | |
and https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html | |
for webgl-utils, m3, m4, and webgl-lessons-ui. | |
--> | |
<script src="https://webglfundamentals.org/webgl/resources/webgl-utils.js"></script> | |
<script src="https://webglfundamentals.org/webgl/resources/m4.js"></script> |
// each( collection { obj || array }, callback, [ context ] ) | |
// iterates over a collection, runs callback with either collection or optional context as value of 'this' | |
// | |
// callback sent the following arguments: | |
// * current item value | |
// * index or key | |
// * collection | |
( function( global ) { |
function removeDuplicates(originalArray, prop) { | |
var newArray = []; | |
var lookupObject = {}; | |
for(var i in originalArray) { | |
lookupObject[originalArray[i][prop]] = originalArray[i]; | |
} | |
for(i in lookupObject) { | |
newArray.push(lookupObject[i]); | |
} |
$.fn.serializeObject = function() { | |
var data = {}; | |
$.each( this.serializeArray(), function( key, obj ) { | |
var a = obj.name.match(/(.*?)\[(.*?)\]/); | |
if(a !== null) | |
{ | |
var subName = new String(a[1]); | |
var subKey = new String(a[2]); | |
if( !data[subName] ) { | |
data[subName] = { }; |
import _ from 'lodash'; | |
const invoke = new Proxy(_.invoke, { | |
apply(target, thisArg, argArray: any[]): any { | |
try { | |
return Reflect.apply(target, thisArg, argArray); | |
} catch (e) { | |
if (process.env.NODE_ENV === 'development') { | |
console.debug('[safe-invoke] discarding exception', e, ...argArray); | |
} |
async function checkAvgPerf() { | |
const numberOfReads = 100000; | |
const numberOfTests = 100; | |
const eps = 0.000001; | |
const mapAvg = []; | |
const objAvg = []; | |
let mapSlowerOnAvgTimes = 0; | |
let objSlowerOnAvgTimes = 0; | |
let equalTimes = 0; |
Some stats: - Total number of links: 23983
function clone(obj) { | |
if (null == obj || "object" != typeof obj) return obj; | |
var copy = new obj.constructor(); | |
for (var attr in obj) { | |
if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr]; | |
} | |
return copy; | |
} |