Skip to content

Instantly share code, notes, and snippets.

View anissen's full-sized avatar

Anders Nissen anissen

View GitHub Profile
@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 / maybe.hx
Created November 3, 2015 07:12
Test of pseudo-monads in haxe
import haxe.ds.Option;
using Test.OptionTools;
class OptionTools {
static public function fmap<T>(m :Option<T>, f :T->T) :Option<T> {
switch m {
case Some(x): return Some(f(x));
case None: return None;
}
@anissen
anissen / Main.hx
Last active November 26, 2015 13:13 — forked from francescoagati/Main.hx
Import JSON in Haxe at compile time
#if macro
import haxe.macro.Context;
#end
class Main {
macro static function load_json(file :String) {
var data = sys.io.File.getContent(file);
var json = haxe.Json.parse(data);
return Context.makeExpr(json, Context.currentPos());
@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 / ThreadPool.hx
Created December 16, 2015 20:27 — forked from hamaluik/ThreadPool.hx
Platform-agnostic thread pool for Haxe / OpenFL
package com.blazingmammothgames.util;
#if neko
import neko.vm.Thread;
import neko.vm.Mutex;
#elseif cpp
import cpp.vm.Thread;
import cpp.vm.Mutex;
#end
@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.