Skip to content

Instantly share code, notes, and snippets.

@ubaltaci
ubaltaci / three_3d_text.js
Created September 17, 2014 12:27
three.js 3d text
var text3d = new THREE.TextGeometry("123123123131", {
size: 0.2,
height: 0.1,
font: 12
});
text3d.computeBoundingBox();
var material = new THREE.MeshFaceMaterial([
new THREE.MeshPhongMaterial({color: 0xffffff, shading: THREE.FlatShading}), // front
new THREE.MeshPhongMaterial({color: 0xffffff, shading: THREE.SmoothShading}) // side
@zz85
zz85 / undo.js
Last active July 26, 2022 20:18
Simple Undo / Redo System
// Simple Undo / Redo System
/*
* @author joshua koo / http://joshuakoo.com
*
* There are usually 2 different ways to handle undo / redo
* 1. you snapshot and store the states, so you can load them anytime
* 2. you store the deltas, actions, events or commands between save points.
*
* Method 1 is simplistic. But it works. It's a lot like git.
@zz85
zz85 / drag.js
Last active July 26, 2022 19:00
Generic onDrag handler
/*
@author twitter.com/blurspline
*/
function handleDrag(element, ondown, onmove, onup, down_criteria) {
var pointer = null;
var bounds = element.getBoundingClientRect();
element.addEventListener('mousedown', onMouseDown);
@cmbaughman
cmbaughman / TextBookSearch.md
Last active February 28, 2025 12:07
Searching for Text Books

Note: I found this on the /r/Piracy subreddit (https://www.reddit.com/r/Piracy/comments/3i9y7n/guide_for_finding_textbooks/?sort=confidence) however I am including a copy here just in case.

So you have a list of books you need to buy for college. There are some really great resources for finding them online, but I'm going to run through the easiest methods for searching all of them here.

First, let's start off by using the method that will allow you to find the vast majority of books. Google. It tends to be easier if you can search multiple sites at once, and this is the easiest way to do it.

There was a search engine that /u/ratokursi made 3 years ago, but by now most of the sites are either dead or have changed the url. I decided to make a new one, this time after reviewing 100+ sites and adding to working ones to the custom search engine.

https://cse.google.com/cse/publicurl?cx=011394183039475424659:5bfyqg89ers

@mysticw
mysticw / .bash_profile
Last active June 25, 2022 11:32
Pantheon Workflow Automation (pwa): Commands to automate your Pantheon development experience. Just copy these commands into your .bash_profile or .bashrc, update the pdw-auth command to use your credentials, install Terminus (https://github.com/pantheon-systems/cli/wiki/Installation), and go!
#------------------------------------------
# PANTHEON WORKFLOW AUTOMATION v0.1
# Using the Pantheon CLI (terminus) v0.71
#------------------------------------------
# Create a backup of the Live Environment
# eg. pwa-backup mysite live db
function pwa-backup(){
terminus site backup create --site=$1 --env=$2 --element=$3 --latest
}
@jzitelli
jzitelli / test_VREffect.html
Created September 20, 2015 04:22
VREffect example where the camera is child of an object which has dynamic matrixWorld
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - native vr demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #f0f0f0;
@garmjs
garmjs / example.js
Last active July 29, 2022 17:20
React Delete item
let taskIndex = parseInt(e.target.value, 10);
console.log('remove task: %d', taskIndex, this.state.list[taskIndex]);
this.setState(state => {
state.list.splice(taskIndex, 1);
return {items: state.list};
});
@garmjs
garmjs / React Filter List.js
Created November 18, 2015 19:54
React Filter
var updatedList = this.state.list.filter(function(item){
return item.toLowerCase().search(
evt.target.value.toLowerCase()) !== -1;
});
this.setState({ list: updatedList });
@d2s
d2s / installing-node-with-nvm.md
Last active July 4, 2025 04:54
Installing Node.js to Linux & macOS & WSL with nvm

Installing Node.js with nvm to Linux & macOS & WSL

A quick guide on how to setup Node.js development environment.

Install nvm for managing Node.js versions

nvm allows installing several versions of Node.js to the same system. Sometimes applications require a certain versions of Node.js to work. Having the flexibility of using specific versions can help.

  1. Open new Terminal window.
//Functions
// `current` API function returns the current step step
var current = function() {
return steps.indexOf(activeStep);
};
// `total` API function returns the number of steps present
var total = function() {
return steps.length;