Skip to content

Instantly share code, notes, and snippets.

@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.
*/
@mathiasbynens
mathiasbynens / change-favicon.js
Created June 7, 2010 12:41
Dynamically changing favicons with JavaScript
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {
/*
* A simple ringo websocket extension. Add the following code to your webapp's
* config.js file to enable it:
*
* exports.extensions = ["websocket-extension"];
*/
var websocket = require("ringo/webapp/websocket");
exports.serverStarted = function(server) {
public class PipeTest {
public static void main(String[] args) throws java.io.IOException, java.lang.InterruptedException {
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
// Start three processes: ps ax | grep rbe | grep JavaVM
java.lang.Process p1 = rt.exec("ps ax");
java.lang.Process p2 = rt.exec("grep rbe");
java.lang.Process p3 = rt.exec("grep JavaVM");
// Start piping
java.io.InputStream in = Piper.pipe(p1, p2, p3);
@BonsaiDen
BonsaiDen / bezierCurve.js
Created November 10, 2010 02:24
Bezier Curve in JS, includes arc-length parameterization stuff
function Bezier(a, b, c, d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.len = 100;
this.arcLengths = new Array(this.len + 1);
this.arcLengths[0] = 0;
@bebraw
bebraw / gameengines.md
Created January 6, 2011 18:07
List of JS game engines. You can find a wikified version at https://github.com/bebraw/jswiki/wiki/Game-Engines. Feel free to modify that. I sync it here every once in a while.

IMPORTANT! Remember to check out the wiki page at https://github.com/bebraw/jswiki/wiki/Game-Engines for the most up to date version. There's also a "notes" column in the table but it simply does not fit there... Check out the raw version to see it.

This table contains primarily HTML5 based game engines and frameworks. You might also want to check out the [[Feature Matrix|Game-Engine-Feature-Matrix]], [[Game Resources]] and [[Scene Graphs]].

Name Size (KB) License Type Unit Tests Docs Repository Notes
Akihabara 453 GPL2, MIT Classic Repro no API github Intended for making classic arcade-style games in JS+HTML5
AllBinary Platform Platform Dependent AllBinary 2D/2.5D/3D n
@jasongraham
jasongraham / markdownize_cgit.py
Created January 9, 2011 23:55
Used by the cgit 'about-filter' to parse a markdown file.
#!/usr/bin/env python
#
# Copyright 2011, Jason Graham
#
# Uses python-markdown to convert a markdown document to the body
# of an HTML document to display with cgit (http://hjemli.net/git/cgit/).
#
# Install:
#
# 1- Install python-markdown ( sudo apt-get install python-markdown )
@lamberta
lamberta / gist:882023
Created March 22, 2011 20:54
My wget incantation for downloading a local copy of the Mozilla JavaScript Reference.
#set DOC_ROOT, no trailing slash on url
#front page: $DOC_ROOT/javascript/en/JavaScript/Reference.html
wget -mkpE -np -nH -P "$DOC_ROOT/javascript" "https://developer.mozilla.org/en/JavaScript/Reference"
@robi42
robi42 / gist:1078959
Created July 12, 2011 20:52
Conveniently iterate over a java.util.HashSet in Ringo
$ ringo
>> set = new java.util.HashSet(['foo', 'bar'])
[java.util.HashSet [foo, bar]]
>> for each (var element in Iterator(set)) print(element)
foo
bar
>>
@tbranyen
tbranyen / app.js
Created September 22, 2011 16:51
backbone.js sub routing
/* Pretend app setup stuff is here */
/* Kick off app */
jQuery(function($) {
var Gallery = app.module("gallery");
app.Router = Backbone.Router.extend({
initialize: function() {
this.gallery = new Gallery.Router("gallery/");