Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.Handle("/api/v1", businessLogic("12345"))
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
)
func chain(chain ...http.HandlerFunc) http.Handler {
func chain(chain ...http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
for _, h := range chain {
h(w, r)
}
})
}
func main() {
http.Handle("/api/v1", chain(logger, businessLogic("99999", runTimeFunc)))
func logger(w http.ResponseWriter, r *http.Request) {
log.Printf("Request %v", r.URL.Path)
}
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
)
func main() {
@benjohns1
benjohns1 / FreeCameraControllerRx.cs
Created October 14, 2018 16:00
Drop-in camera controller for Unity that works with default project axes, built with UniRx
using UniRx;
using UniRx.Triggers;
using UnityEngine;
public class FreeCameraControllerRx : MonoBehaviour
{
[Header("Speed Settings")]
public float speed = 10f;
public float fastSpeed = 80f;
public float rollSpeed = 80f;
@benjohns1
benjohns1 / FreeCameraController.cs
Last active October 14, 2018 15:58
Drop-in camera controller for Unity that works with default project axes
using UnityEngine;
public class FreeCameraController : MonoBehaviour
{
[Header("Speed Settings")]
public float speed = 10f;
public float fastSpeed = 80f;
public float rollSpeed = 80f;
public float fastRollSpeed = 150f;
public Vector2 mouseSensitivity = new Vector2(100f, 100f);
@benjohns1
benjohns1 / gist:4631602
Last active December 11, 2015 16:59
Sample Gist for CX Dev Testing
/*
* Sample
*/
class SampleClass {
protected $test = false;
function __construct() {
$this->test = true;
}