Skip to content

Instantly share code, notes, and snippets.

(cond (= <some future dynamic path>)
(return-dynamic-content ...)
<other dynamic paths>
(static-files/file-exists? (:uri request)) (return-file ...)
:else (return-404))
EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
if (!aContext) {
aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
}
@rje
rje / gist:5139444
Last active December 14, 2015 19:49
Byrdr phone number pin codes
0000: Combos Message
1111: Suzanne
1234: Moon
1957: J. Eagler Personal Account
8111: Another Suzanne account
Invalid:
0007
1007
1112
@rje
rje / gist:6206099
Created August 11, 2013 17:46
HSV for Unity
using UnityEngine;
using System.Collections;
public class HSVColor {
// h = 0.0 -> 360.0, s = 0.0 -> 1.0, v = 0.0 -> 1.0
public static Color HSVToRGB(float h, float s, float v) {
if(s == 0) {
return new Color(v, v, v, 1);
}
List<MyBaseClass> m_listOfObjects; // initialized somewhere else
public T FindFirstObjectOfType<T>() where T: MyBaseClass
{
foreach(var toCheck in m_listOfObjects)
{
if(toCheck.getType() == typeof(T))
{
return toCheck as T;
}
@rje
rje / gist:7796728
Last active December 30, 2015 07:29
Famicom Collection

looking for

  • castlevania 3
  • cho wakusei senki metafight (blaster master)
  • mother

bids

  • downtown nekketsu monogatari (river city ransom)
var stack = new System.Diagnostics.StackTrace(true);
foreach(var frame in stack.GetFrames ()) {
if(!string.IsNullOrEmpty(frame.GetFileName())) {
Debug.Log (frame.GetMethod () + ": " + frame.GetFileName() + ":" + frame.GetFileLineNumber());
}
}
@rje
rje / gist:11408219
Created April 29, 2014 18:27
audio spectrum code
using UnityEngine;
using System.Collections;
/// <summary>
/// A class for taking spectrum data & calculating the volume of various frequency bands.
///
/// Notes:
/// This doesn't do any smoothing, so wherever you leverage these values you'll probably want to do something.
/// In my project I immediately jump to any higher value, and then have it decay over time at a fixed rate.
/// </summary>
using UnityEngine;
using System.Collections;
public class RotateObject : MonoBehaviour {
public float RotationPerPixelMovement = 1.0f;
GameObject _toRotate;
bool _rotating = false;
Vector3 _lastPosition;
@rje
rje / williams.c
Created May 25, 2014 17:32
williams synth
#define CR_START(n) { int *crptr = (n); switch(*crptr) { case 0:
#define CR_YIELD_VOID do { *crptr =__LINE__; return; case __LINE__:;}while(0);
#define CR_YIELD(x) do { *state =__LINE__; return x; case __LINE__:; }while(0);
#define CR_END }}
typedef struct
{
float vol;
float duration;
}WILLIAMS_CONFIG;