Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
@topherfangio
topherfangio / test.handlebars
Created March 3, 2011 14:37
TemplateView with Handlebars
<h1>Test Handlebars Page</h1>
<p>
I really like {{ somevar }}!
</p>
@rygorous
rygorous / gist:2246678
Created March 30, 2012 05:09
float->sRGB8 for ISPC 1.2.0
// float->sRGB8 conversions - two variants.
// by Fabian "ryg" Giesen
//
// I hereby place this code in the public domain.
//
// Both variants come with absolute error bounds and a reversibility and monotonicity
// guarantee. They should pass D3D10 conformance testing.
//
// This is an ISPC port of https://gist.github.com/2203834 - see there for a test
// driver and code that computes the tables.
@endobson
endobson / Tree.v
Created April 30, 2012 00:46
Tree Identities in Coq
Require Import List.
Inductive btree : Set :=
| bleaf : btree
| bbranch : btree -> btree -> btree.
Fixpoint btree_id(x : btree) : btree :=
match x with
| bleaf => bleaf
| bbranch l r => bbranch (btree_id l) (btree_id r)
@gseitz
gseitz / FSMSupervision.scala
Created August 23, 2012 21:12
Akka FSM Supervision
package akka.actor
import collection.mutable
import akka.actor.FSM.{ CurrentState, Transition, UnsubscribeTransitionCallBack, SubscribeTransitionCallBack }
import akka.routing.{ Deafen, Listen }
case object PreRestart
case object PostRestart
trait ParentNotification { thisActor: Actor ⇒
@chrsan
chrsan / AkkaSourceDiscriminator.java
Created September 27, 2012 13:14
A logback discriminator for the akkaSource MDC value.
package se.fishtank;
import java.net.URI;
import java.util.Map;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.sift.Discriminator;
import ch.qos.logback.core.spi.ContextAwareBase;
public class AkkaSourceDiscriminator extends ContextAwareBase implements Discriminator<ILoggingEvent> {
@hintjens
hintjens / zcurve.c
Last active December 15, 2015 07:39
CurveZMQ prototype - see http://hintjens.com/blog:36 for the story.
/* =========================================================================
CurveZMQ - authentication and confidentiality for 0MQ
-------------------------------------------------------------------------
Copyright (c) 1991-2013 iMatix Corporation <www.imatix.com>
Copyright other contributors as noted in the AUTHORS file.
This is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
@apaprocki
apaprocki / issue5564.cc
Last active December 17, 2015 20:59
Using libuv to create a loop which uses `UV_RUN_ONCE` to handle either a single timer firing or async send. If the timeout for the timer is 0ms, only one `UV_RUN_ONCE` is needed, but if the timeout is > 0ms, a second `UV_RUN_ONCE` call is needed or the timer callback does not fire.
// Compiling from toplevel of built node.js repo on OSX:
// CC -g -o issue5564 issue5564.cc -I deps/uv/include/ \
// -L out/Debug/ -luv -framework CoreFoundation -framework Carbon
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "uv.h"
@enjalot
enjalot / Draggable.coffee
Created August 6, 2013 23:54
drag and drop in derby (by @ishbu)
helpers = require('../util').helpers
module.exports = Draggable = (e, containerEl, handle, dragSelector, handleSelector, component, @moveCallback, startX, startY) ->
items = containerEl.querySelectorAll dragSelector
if dragSelector == handleSelector
el = handle
else
handles = containerEl.querySelectorAll handleSelector
index = nodeIndex handles, handle
el = items[index]
@ivochkin
ivochkin / CMakeLists.txt
Created December 16, 2013 19:40
Example of integrating capnproto library into existing cmake project that already uses gmock as external project.
include(ExternalProject)
ExternalProject_Add(gmock
SVN_REPOSITORY http://googlemock.googlecode.com/svn/tags/release-1.7.0
CMAKE_ARGS -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)
ExternalProject_Get_Property(gmock source_dir)
;;;; metal/compiler.lisp
;;;;
;;;; Copyright (c) 2015 Adrian Medina
(in-package :metal)
(defparameter *metal-source-paths*
(asdf:system-relative-pathname *system* "src/metal/"))
(defun metal (pathname)