Skip to content

Instantly share code, notes, and snippets.

xogeny /
Last active Apr 27, 2018
A quick example of defining a collection of Siren resources


I've been thinking a lot lately about the value of having a high-level profile for a hypermedia APIs. These are some thoughts. I should point out that I have a "Siren-centric" focus here, but I suspect such a proile, if done right, could really open things up for hypermedia APIs in general, independent of format, by providing a single source of truth about the potential resources, their properties, their actions and their relations.


The goal here is to describe a Siren API so that it can be both documented and validated.

xogeny / storybook_spec.js
Created Oct 18, 2017
Cypress testing of Storybook
View storybook_spec.js
// Tests built around our Storybook
describe('Storybook', () => {
beforeEach(() => {
// Visiting our app before each test removes any state build up from
// previous tests. Visiting acts as if we closed a tab and opened a fresh one.
// In this case, we are using the publicly accessible AirBnB react-dates Storybook
// Let's build some tests around the DateRangePicker
context('DateRangePicker', () => {
xogeny / react-toolbox.d.ts
Created Nov 20, 2015
Initial cut at creating TypeScript declarations for react-toolbox
View react-toolbox.d.ts
// Type definitions for react-toolbox 0.12.11
// Project:
// Definitions by: @xogeny (Michael M. Tiller)
///<reference path='../react/react.d.ts' />
declare namespace __RT {
import React = __React;
// Properties that all components have
xogeny / gist:ad2e563637d868b9c54d
Last active Aug 27, 2015
Publishing a message that exceeds the maximum gnatsd payload size
View gist:ad2e563637d868b9c54d
package main
import (
gs ""
func msg(n int) []byte {
xogeny / gist:fcbeba98b8d70dc5003a
Created Jul 8, 2015
My canonical directive structure
View gist:fcbeba98b8d70dc5003a
/// <reference path="../typings/angularjs/angular.d.ts" />
// A canonical layout for defining angular directives in TypeScript
module ModuleForDirective {
// Defines what we expect to find in $scope. This mainly the stuff
// mapped in the scope: attribute of the directive, but it could
// include stuff inherited into $scope as well...
interface Scope extends ng.IScope {
// Stuff defined in { scope: { ... } } (attrs on directive)
// Stuff inherited in $scope
View ScalaPlayground.scala
object ScalaJSExample extends js.JSApp {
def main() = {
val (h, w) = (Page.canvas.height, Page.canvas.width)
Page.renderer.fillStyle = "blue"
Page.renderer.fillRect(20, 20, 30, 30)
xogeny / append2_test.go
Created Jan 27, 2015
A different append benchmark for Golang
View append2_test.go
package copy_vs_append
import (
func buildArray(n int64) []int64 {
ret := make([]int64, n, n)
var i int64
for i = 0; i < n; i++ {
xogeny / append_test.go
Created Jan 27, 2015
Benchmark for append vs. copy in Golang
View append_test.go
package copy_vs_append
import (
func TestCopy(t *testing.T) {
y := doCopy(true, false)
if len(y) != 1000 {
t.Fatalf("Expected len(y) to be 1000 but was %d", len(y))