Skip to content

Instantly share code, notes, and snippets.

View imgntn's full-sized avatar

James B. Pollack, MFA imgntn

View GitHub Profile
@banksean
banksean / perlin-noise-classical.js
Created February 15, 2010 10:00
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
@rbackhouse
rbackhouse / V8CommonJSLoader.java
Created March 24, 2011 01:30
Example demonstrating calling the commonjs loader via V8
import java.io.IOException;
import org.dojotoolkit.rt.v8.V8JavaBridge;
import org.dojotoolkit.server.util.resource.ResourceLoader;
public class V8CommonJSLoader extends V8JavaBridge {
private ResourceLoader resourceLoader = null;
public V8CommonJSLoader(ResourceLoader resourceLoader) {
super(true);
this.resourceLoader = resourceLoader;
@zz85
zz85 / THREE.FontText.js
Created May 24, 2011 11:46
THREE.FontText
/**
* @author mr.doob / http://mrdoob.com/
* @author philogb / http://blog.thejit.org/
* @author zz85 / http://www.lab4games.net/zz85/blog
*/
THREE.Vector2 = function ( x, y ) {
this.set(
@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;
@nuxlli
nuxlli / localstorage.js
Created November 2, 2011 15:28
Fallback to localStorage in Samsung Smart TV
/**
* Fallback to localStorage
**/
;(function() {
if (typeof localStorage == "undefined" && typeof FileSystem == "function") {
var fileSyObj = new FileSystem();
var fileName = curWidget.id + "_localStorage.db";
var lStorage = {};
var changed = false;
@geddski
geddski / nesting.js
Created January 14, 2012 05:08
helper function for nesting backbone collections.
function nestCollection(model, attributeName, nestedCollection) {
//setup nested references
for (var i = 0; i < nestedCollection.length; i++) {
model.attributes[attributeName][i] = nestedCollection.at(i).attributes;
}
//create empty arrays if none
nestedCollection.bind('add', function (initiative) {
if (!model.get(attributeName)) {
model.attributes[attributeName] = [];
@joefitzgerald
joefitzgerald / gist:1990736
Created March 7, 2012 03:32
Handlebars JST Grunt Task
/*
* Grunt Task File
* ---------------
*
* Task: JST-HB
* Description: Compile handlebars templates to JST file.
* Dependencies: underscore@1.2.4
*
*/
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@paulirish
paulirish / performance.now()-polyfill.js
Last active August 1, 2023 15:42
performance.now() polyfill (aka perf.now())
// @license http://opensource.org/licenses/MIT
// copyright Paul Irish 2015
// Date.now() is supported everywhere except IE8. For IE8 we use the Date.now polyfill
// github.com/Financial-Times/polyfill-service/blob/master/polyfills/Date.now/polyfill.js
// as Safari 6 doesn't have support for NavigationTiming, we use a Date.now() timestamp for relative values
// if you want values similar to what you'd get with real perf.now, place this towards the head of the page
// but in reality, you're just getting the delta between now() calls, so it's not terribly important where it's placed
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }