Skip to content

Instantly share code, notes, and snippets.

View jsermeno's full-sized avatar

Justin Sermeno jsermeno

  • Mountain View, CA
View GitHub Profile
@jsermeno
jsermeno / FastList.tsx
Created April 23, 2023 00:47 — forked from derekstavis/FastList.tsx
Discord's FastList, but in TypeScript
import { forEachObjIndexed } from "ramda";
import * as React from "react";
import {
Animated,
ScrollView,
View,
ViewStyle,
LayoutChangeEvent,
NativeScrollEvent,
} from "react-native";
@jsermeno
jsermeno / config-haproxy.sh
Created June 20, 2011 08:51
Node.js server and Web Sockets on Amazon EC2 with Express.js and Socket.IO - http://catchvar.com/nodejs-server-and-web-sockets-on-amazon-ec2-w
# HAProxy config
mkdir /etc/haproxy
cat > /etc/haproxy/haproxy.cfg << EOF
global
maxconn 4096
defaults
mode http
@jsermeno
jsermeno / cube.js
Created September 19, 2011 06:46
Three.js Infinite Terrain
cube = new THREE.CubeGeometry( block_size, block_size, block_size, 1, 1, 1, materials, false, { px: px, nx: nx, py: py, ny: ny, pz: pz, nz: nz });
@jsermeno
jsermeno / animation.html
Created August 24, 2011 05:58
Three.js Troll Animation Morph Targets
<!doctype html>
<html>
<head>
<title>Three.js - Game</title>
<meta charset="utf-8">
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
var
camera,
scene,
renderer;
function initialize() {
var
grass,
meshCanvas,
plane,
// Bind context
_.bindAll( this, "animate", "render", "update" );
// Initialize camera
this.camera = new THREE.Camera( 45, window.innerWidth / window.innerHeight, -2000, 10000 );
this.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, -2000, 10000 );
this.camera.position.y = 70.711;
this.camera.position.x = 100;
this.camera.position.z = 100;
@jsermeno
jsermeno / perspectiveProject.js
Created June 5, 2011 03:19
Three.js Transform 3D coordinates to screen coordinates and back in perspective projection - http://catchvar.com/threejs-game-transforming-isometric-screen-co
var
projector = new THREE.Projector(),
p3D = new THREE.Vector3(25, 15, 9),
p2D;
p2D = projector.projectVector(p3D, camera);
p3D = projector.unprojectVector(p2D, camera);
@jsermeno
jsermeno / copy_railscast.sh
Created September 18, 2011 08:33
Setup Vim
cp ~/Downloads/railscasts.vim ~/.vim/colors
@jsermeno
jsermeno / avoid_window.js
Created September 11, 2011 02:36
Window, Self, and Web Workers
if ( window.Blob === undefined ) {
// attach library custom implementation
} else {
// use native implementation
}
@jsermeno
jsermeno / perlin_noise_indices.js
Created August 9, 2011 08:14
Perlin Noise Negative Coordinates
noise: function (x, y, z) {
// Find unit cube that contains point
var xFloor = ~~x;
var yFloor = ~~y;
var zFloor = ~~z;
var iX = xFloor & 255;
var iY = yFloor & 255;
var iZ = zFloor & 255;