Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am rxet on github.
  • I am rxet (https://keybase.io/rxet) on keybase.
  • I have a public key ASCEHlK1KqALZN_qYw0qQTuV4JgbivXfwwLqWuBh0g_tLAo

To claim this, I am signing this object:

@RxET
RxET / maximum-increasing-subsequence.md
Created June 21, 2018 22:43
Maximum Increasing Subsequence

Prompt

Given an an array of numbers, find the length of the longest possible subsequence that is increasing. This subsequence can "jump" over numbers in the array. For example in [3, 10, 4, 5] the longest increasing subsequence (LIS) is [3, 4, 5].

Examples

longestIncreasingSubsequence([3, 4, 2, 1, 10, 6]);
// should return 3, the length of the longest increasing subsequence:
// 3, 4, 6 (or 3, 4, 10)
@RxET
RxET / yourThreeFull.js
Created March 20, 2018 04:48
Three.js or There’s a hypercube in my timeline and I can’t get out
window.addEventListener('load', setUp, false);
function setUp() {
// scene, camera, and renderer
makeScene();
// add an object
createBox();
// and a light
@RxET
RxET / yourThreeAnimate.js
Last active March 20, 2018 03:59
Three.js or There’s a hypercube in my timeline and I can’t get out
function animate() {
//keep calling our animate function to keep the motion flowing
requestAnimationFrame( animate );
//finally render our scene
renderer.render( scene, camera );
//give our box a little twist
box.rotation.x += 0.01;
box.rotation.y += 0.01;
@RxET
RxET / yourThreeVariables.js
Last active March 20, 2018 03:29
Three.js or There’s a hypercube in my timeline and I can’t get out
//declare these variables in the global scope so our functions have access to them later
var scene;
var camera;
var box;
var renderer;
var controls;
@RxET
RxET / yourThreeBox.js
Last active March 20, 2018 03:33
Three.js or There’s a hypercube in my timeline and I can’t get out
function createBox() {
//create the box geometry
var boxGeometry = new THREE.BoxGeometry( 1, 1, 1 );
//create the material, this one is purple and affected by lights
var boxMaterial = new THREE.MeshPhongMaterial( { color: 0xffffff } )
//smash them together in a mesh, and add to your scene
box = new THREE.Mesh(boxGeometry, boxMaterial);
@RxET
RxET / yourThreeLights.js
Last active March 20, 2018 03:34
Three.js or There’s a hypercube in my timeline and I can’t get out
function letThereBeLight() {
//create your light - this one is white at almost full intensity
var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.9 );
// set the light direction
directionalLight.position.set(150, 350, 350);
//let it cast shadows
directionalLight.castShadow = true;
@RxET
RxET / yourThreeScene.js
Last active March 20, 2018 03:30
Three.js or There’s a hypercube in my timeline and I can’t get out
function makeScene() {
//get browser width and height
var WIDTH = window.innerWidth;
var HEIGHT = window.innerHeight;
// make a scene
scene = new THREE.Scene();
// and a camera
var aspectRatio = WIDTH / HEIGHT;
@RxET
RxET / yourThreeFile.js
Last active March 19, 2018 07:34
Three.js or There’s a hypercube in my timeline and I can’t get out
window.addEventListener('load', setUp, false);
function setUp() {
// scene, camera, and renderer
makeScene();
// add a light
letThereBeLight();
// and an object
@RxET
RxET / index.html
Last active March 19, 2018 06:46
Three.JS or There’s a hypercube in my timeline and I can’t get out
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/three.js/91/three.js"></script>
<script type="text/javascript" src="yourThreeFile.js"></script>
</head>
<body>
<div id="threeContainer"></div>
</body>
</html>