This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!coffee | |
# | |
# required | |
# - vector.coffee - gist: 1177722 | |
# | |
vector = require './vector' | |
isCollided = (sector, point) -> | |
# Collision detection of circular sector and point | |
toRadian = (d) -> d * Math.PI / 180 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package akka.contrib.pattern | |
import language.postfixOps | |
import scala.concurrent.duration._ | |
import com.typesafe.config.ConfigFactory | |
import akka.actor.Actor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Generates a trail that is always facing upwards using the scriptable mesh interface. | |
vertex colors and uv's are generated similar to the builtin Trail Renderer. | |
To use it | |
1. create an empty game object | |
2. attach this script and a MeshRenderer | |
3. Then assign a particle material to the mesh renderer | |
*/ | |
var height = 2.0; | |
var time = 2.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Diffuse Lightmap" { | |
Properties { | |
_MainTex ("Texture 1", 2D) = "white" {} | |
} | |
SubShader { | |
Tags { "RenderType" = "Opaque" } | |
Pass { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Globalization; | |
using System.IO; | |
using System.Text; | |
using UnityEditor; | |
using UnityEngine; | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private enum Color { Red; Black; } | |
private enum TreeT<T> { | |
Leaf; | |
Node(color: Color, left: TreeT<T>, label: T, right: TreeT<T>); | |
} | |
private class TreeF { | |
private function new() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import haxe.ds.Option; | |
using Lambda; | |
using OptionOp; | |
class LambdaOp { | |
public static function flatten<A>(it: Iterable<Option<A>>): Iterable<A> { | |
return it.filter(function(elem) { | |
return elem.isDefined(); | |
}).map(function(elem) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nape.util.BitmapDebug; | |
import nape.geom.Vec2; | |
class Perlin3D { | |
public static inline function noise(x:Float, y:Float = 0.0, z:Float = 0.0) { | |
var X:Int = untyped __int__(x); x -= X; X &= 0xff; | |
var Y:Int = untyped __int__(y); y -= Y; Y &= 0xff; | |
var Z:Int = untyped __int__(z); z -= Z; Z &= 0xff; | |
var u = fade(x); var v = fade(y); var w = fade(z); | |
var A = p(X) +Y; var AA = p(A)+Z; var AB = p(A+1)+Z; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream, | |
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback | |
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance | |
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible). | |
var reqUrl = url.parse(req.url, true) | |
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined; | |
if (cameraName) { | |
try { | |
cameraName = decodeURIComponent(cameraName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import haxe.remoting.Context; | |
import haxe.remoting.HttpConnection; | |
import haxe.remoting.SocketConnection; | |
import haxe.remoting.SocketProtocol; | |
import neko.vm.Thread; | |
import sys.net.Host; | |
import sys.net.Socket; | |
import Sys.println; | |
class Mini2 { |
OlderNewer