Skip to content

Instantly share code, notes, and snippets.

View anissen's full-sized avatar

Anders Nissen anissen

View GitHub Profile
@anissen
anissen / coffeekup-processing.coffee
Created January 7, 2012 22:06
Pretty cool page (server included) using coffeekup, processing.js and node.js in less than 40 lines of code
kup = require 'coffeekup'
# Client-side web page with canvas and processing
webpage = kup.render ->
doctype 5
html ->
head ->
meta charset: 'utf-8'
title 'CoffeeKup Processing'
style '''body { background-image:url('http://icanhasnoise.com/1d0b07-4a2219/40x1500/4'); text-align: center; } header { font-family: 'Lobster Two', cursive; font-size: 28px; color: white; text-shadow: 3px 3px 3px brown; }'''
link rel: 'stylesheet', href: 'http://fonts.googleapis.com/css?family=Lobster+Two&v2'
@anissen
anissen / zappa-processing.coffee
Created January 8, 2012 12:12
Processing.js demonstration (server included) using zappa, coffeekup and node.js in 30 (!) lines of code
require('zappa') ->
@get '/': -> @render 'index', layout: no
@view index: ->
doctype 5
html ->
head ->
title 'Zappa + CoffeeKup + Processing'
style '''body { background-image:url('http://icanhasnoise.com/1d0b07-4a2219/40x1500/4'); text-align: center; } header { font-family: 'Lobster Two', cursive; font-size: 28px; color: white; text-shadow: 3px 3px 3px brown; }'''
link rel: 'stylesheet', href: 'http://fonts.googleapis.com/css?family=Lobster+Two&v2'
script src: 'http://processingjs.org/content/download/processing-js-1.3.6/processing-1.3.6-api.min.js'
@anissen
anissen / index.html
Last active December 10, 2015 11:49
three.js example for testing out bl.ocks.org
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - draggable cubes</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;
@anissen
anissen / index.html
Created January 2, 2013 21:30
Testing out cu.bes by separating html and script
<!DOCTYPE html>
<html lang="en">
<head>
<title>cube</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;
@anissen
anissen / script.js
Created January 2, 2013 22:15
Testing out cu.bes by omitting index.html and setup.js
var projector;
var objects = [], plane;
var mouse = new THREE.Vector2(),
offset = new THREE.Vector3(),
INTERSECTED, SELECTED;
initBoxes();
function initBoxes() {
@anissen
anissen / readme.md
Last active December 10, 2015 17:48
Simple cube example

Example cube

Added a simple cube while taking advantage of Cubic's built-in three.js bootstrapping

@anissen
anissen / index.html
Created March 9, 2013 22:18
EaselJS touch events on mobile devices
<html>
<head>
<meta name="viewport" content="initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,width=device-width,height=device-height,target-densitydpi=device-dpi,user-scalable=yes"
/>
<script src="https://raw.github.com/CreateJS/EaselJS/master/lib/easeljs-0.6.0.min.js"></script>
</head>
<body>
<canvas id="testCanvas" width="640" height="480" style="background: black;"></canvas>
@anissen
anissen / gist:7535140
Created November 18, 2013 20:56
Temp. fork of Fractal Cartoon on ShaderToy
// "Fractal Cartoon" - former "DE edge detection" by Kali
// Cartoon-like effect using eiffies's edge detection found here:
// https://www.shadertoy.com/view/4ss3WB
// I used my own method previously but was too complicated and not compiling everywhere.
// Thanks to the suggestion by WouterVanNifterick.
// There are no lights and no AO, only color by normals and dark edges.
@anissen
anissen / .jscs.json
Last active January 25, 2024 23:58
Example gulpfile for some useful tasks
{
"requireCurlyBraces": ["else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"requireLeftStickedOperators": [","],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
@anissen
anissen / gist:a0ed65bf146c7089893e
Created June 11, 2014 19:40
Haxe enum pattern matching
enum Tree<T> {
Leaf(v :T);
Node(l :Tree<T>, r :Tree<T>);
}
class Test {
static function main() {
var myTree = Node(
Leaf("foo"),
Node(