Skip to content

Instantly share code, notes, and snippets.

@asimmakhmudov
asimmakhmudov / index.html
Created January 11, 2024 15:14
WebGL - load obj - w/mtl & specular maps
<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>
@plinionaves
plinionaves / vue-folder-structure.md
Last active April 26, 2024 04:41
Vue Project Folder Structure

Style Guide

This file describes de required Style Guide used by Basicamente to keep the Best Practices on develop new features or improve/change existents one.

Project folder structure

Always follow the folder structure below:

src/
@afahy
afahy / each.js
Created January 6, 2012 04:39
Simple each( obj | array ) function
// 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 ) {
@jpaltahona
jpaltahona / removeDulicate.js
Created September 18, 2020 23:18
Remove duplicate element objs array
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]);
}
@Valeronlol
Valeronlol / Form data to Associate obj.
Created March 17, 2017 13:57
Form data to Associate obj.
$.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] = { };
@arleighdickerson
arleighdickerson / safe-invoke.ts
Created July 9, 2023 16:33
safeInvoke(obj, path[], ...args[])
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);
}
@devlato
devlato / map_vs_obj_benchmark.js
Created September 26, 2023 02:11
Map vs obj read benchmark
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;
@taskylizard
taskylizard / fmhy.md
Last active April 26, 2024 04:39
/r/freemediaheckyeah, in one single file (view raw)
@KrystianP
KrystianP / JS: cloneObject
Last active April 26, 2024 04:39
Clone obj in js
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;
}
@Maksoun44
Maksoun44 / README.md
Created October 22, 2023 23:11
WebGL - load obj - w/vertex colors