Skip to content

Instantly share code, notes, and snippets.

writing code

Joe Pea trusktr

writing code
View GitHub Profile
trusktr /
Last active Jan 20, 2022
Nike SB's On Tap ad campaign with transparent plexiglass ramps and flourescent lighting.

Back in 2004 Nike SB produced an ad campaign using clear transparent skate ramps and obstacles illuminated with florescent lights in dark settings. The skaters did tricks over these obstacles while not having the best visibility of the obstacles they were skating. The difficulty of skating these obstacles added to the already awesome visual effect to create a unique and artful series of skate photos like no other. Enjoy!




View lowclass.ts
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>
type ImplementationKeys = 'static' | 'private' | 'protected'
type FunctionToConstructor<T, TReturn> = T extends (...a: infer A) => void ? new (...a: A) => TReturn : never
// Note, void also works the same in place of unknown
type ReplaceCtorReturn<T, TReturn> = T extends new (...a: infer A) => unknown ? new (...a: A) => TReturn : never
type ConstructorOrDefault<T> = T extends {constructor: infer TCtor} ? TCtor : (() => void)
View three.js-utils.ts
import * as THREE from 'three'
export function isRenderItem(obj: THREE.Object3D): obj is THREE.RenderItem & THREE.Object3D {
return 'geometry' in obj && 'material' in obj
export function disposeMaterial(obj: THREE.Object3D): void {
if (!isRenderItem(obj)) return
// because obj.material can be a material or an array of materials
trusktr / obliterate.js
Created Feb 20, 2019
Obliterate an object
View obliterate.js
// recursively deletes all properties within an `object` or `function`
// TODO option to also handle non-enumerable but configurable descriptors
function obliterate(obj: object) {
const visited = new WeakSet
async function _obliterate(obj) {
if (!obj || !(typeof obj === 'object' || typeof obj === 'function')) return
trusktr / example.js
Last active Nov 18, 2018
Access Modifiers 1
View example.js
class Foo {
foo = 1
protected bar = 2
private baz = 3
public test() {
// call all three of the log methods, one from each access space.
console.log('---- public log 2')
console.log('---- protected log 2')
trusktr / next.config.js
Created Sep 20, 2018
withTranspileModules example
View next.config.js
const path = require("path");
const withTypescript = require("@zeit/next-typescript");
const withCSS = require("@zeit/next-css");
const withSourceMaps = require("@zeit/next-source-maps");
const r = require("regexr");
const cssConfig = {
cssModules: false
trusktr / es5-extend-array.js
Last active Sep 3, 2018
Extending Array with ES5-style class constructors
View es5-extend-array.js
// With some ES2015+ language features:**
function MyArray(...args) {
const self = new Array(...args)
self.__proto__ = MyArray.__proto__
return self
MyArray.prototype = {
__proto__: Array.prototype,
View infamous.8732763c5.js
This file has been truncated, but you can view the full file.
var infamous = (function (exports) {
'use strict';
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function unwrapExports (x) {
return x && x.__esModule &&, 'default') ? x['default'] : x;
View three.trusktr-patch-7.js
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.THREE={})}(this,function(t){"use strict";function e(){}function i(t,e){this.x=t||0,this.y=e||0}function n(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}function r(t,e,i,n){this._x=t||0,this._y=e||0,this._z=i||0,this._w=void 0!==n?n:1}function a(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0}function o(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function s(t,e,n,r,a,c,h,l,u,p){Object.defineProperty(this,"id",{value:Lo++}),this.uuid=Ro.generateUUID(),"",this.image=void 0!==t?t:s.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==e?e:s.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Pa,this.wrapT=void 0!==r?r:Pa,this.magFilter=void 0!==a?a:Oa,this.min
View infamous.a735f17.js
var infamous = (function (exports) {
'use strict';
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at
* Owner:
* @license MPL 2.0
* @copyright Famous Industries, Inc. 2015