Skip to content

Instantly share code, notes, and snippets.

View seanhess's full-sized avatar

Sean Hess seanhess

View GitHub Profile
[self.playersNode observeEventType:FEventTypeChildAdded withBlock:^(FDataSnapshot *snapshot) {
Player * player = [Player new];
[player setValuesForKeysWithDictionary:snapshot.value];
[self.players addObject:player];
if ([player.name isEqualToString:self.currentPlayer.name]) {
self.currentPlayer = player;
} else {
self.opponentNode = [self.playersNode childByAppendingPath:player.name];
self.opponentPlayer = player;
-(id)init {
if (self == [super init]) {
// ... other init stuff
// self.player doesn't even have to be set to set up the binding!
[[RACAble(self.player.health) distinctUntilChanged] subscribeNext:^(id value) {
[self renderHealth];
}];
declare module "rethinkdb" {
export function connect(host:IHost, cb:OnConnect);
export function dbCreate(name:string):AdminOperation;
export function dbDrop(name:string):AdminOperation;
export function dbList():NamesOperation;
export function db(name:string):Db;
export function table(name:string):Table;
@seanhess
seanhess / TestViewController.m
Created June 5, 2013 00:26
ReactiveCocoa is better than KVO and delegates
//
// TestViewController.m
// iOSDemo
//
// Created by Sean Hess on 6/4/13.
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
//
#import "TestViewController.h"
#import "User.h"
@seanhess
seanhess / Book.ts
Last active December 22, 2015 22:59
///<reference path="../def/angular.d.ts"/>
///<reference path="../def/underscore.d.ts"/>
///<reference path="../types.ts"/>
///<reference path="../services/Books"/>
///<reference path="../services/Files.ts"/>
interface BookParams extends ng.IRouteParamsService {
bookId: string;
<html>
<head>
</head>
<body>
<h3>Hello Jason</h3>
<script type='text/javascript'>
console.log("Hello Jason")
<html>
<head>
</head>
<body>
<h3>Risk Calculator</h3>
<script type='text/javascript'>
@seanhess
seanhess / code.js
Created October 11, 2013 12:10
Directive
var app = angular.module('app', []);
app.controller('ConsumingCtrl', function($scope) {
// I want to have the ability for specialIframe to publish an API I can consume, for example a "reload".
// I am aware of events on scope but that is not what I am looking for.
// I could pass in a reference for a specialIframe to bind to on my scope...
// The question is, if specialIframe can publish an API... E.G. "reload" what is the best way to do that.
// $scope.something = "hello"
@seanhess
seanhess / spark_sumo_controller.js
Created December 7, 2013 18:56
required jquery
console.log("HI")
// while pressed,
var KEY_UP = 38
var KEY_DOWN = 40
var KEY_RIGHT = 39
var KEY_LEFT = 37
var STOP = 0;
@seanhess
seanhess / httpexample.js
Last active December 30, 2015 22:39
HTTP and Express Example
// var http = require('http');
// http.createServer(function(req, res) {
// // console.log("REQUEST", req)
// var body = ""
// req.on('data', function(data) {
// body = body + data.toString()
// })
// req.on('end', function() {
// console.log("COMPLETE", JSON.parse(body))