Skip to content

Instantly share code, notes, and snippets.

View philcockfield's full-sized avatar
🐵
!this; !that; !both; !neither;

Phil Cockfield philcockfield

🐵
!this; !that; !both; !neither;
View GitHub Profile
@philcockfield
philcockfield / Thing.ts
Last active October 10, 2018 01:00
Observable Event Pattern Example
import { Subject } from 'rxjs';
/**
* Event declarations.
*/
export type ThingEvent = ThingEventFoo | ThingEventBar; // Type merging.
export type ThingEventFoo = {
type: 'FOO';
payload: {
0x46Bfc199C8E96EA6B0F50cCF62FaBdB2772b9FCe
@philcockfield
philcockfield / .start.sh
Last active May 26, 2016 06:09
NodeAKL Meetup
git clone https://github.com/philcockfield/ui-harness-sample.git && cd ui-harness-sample && npm install

Keybase proof

I hereby claim:

  • I am philcockfield on github.
  • I am philcockfield (https://keybase.io/philcockfield) on keybase.
  • I have a public key whose fingerprint is D0A6 38BE 4BF8 B07A 718C F0F5 2F49 29FA 6FB3 BABE

To claim this, I am signing this object:

@philcockfield
philcockfield / karma.conf.coffee
Last active December 19, 2015 03:09
Karma.conf file as coffee
# base path, that will be used to resolve files and exclude
basePath = '..'
# list of files / patterns to load in the browser
# chai is from https://github.com/chaijs/chai - the main chai.js file in the root
files = [
MOCHA
MOCHA_ADAPTER
# stubs come first so they can be available when all the units need them
@philcockfield
philcockfield / document_model.coffee
Last active January 15, 2018 10:48
Meteor - Model (Logical Document Wrappers).
do ->
core = APP.ns 'core'
Model = core.Model
singletonManagers = {}
###
Base class for models that represent Mongo documents.
@philcockfield
philcockfield / auth.coffee
Created December 3, 2012 07:42
Meteor - Auth with FB JavaScript SDK
do ->
# See: http://developers.facebook.com/docs/reference/javascript/
ns = APP.ns 'core.facebook'
# ---------------------- Methods ----------------------
ns.login = (callback) -> FB.login -> callback?()
ns.logout = (callback) -> FB.logout -> callback?()
ns.signedIn = -> authStatus() is 'signed-in'
{ #each _songs }
<li>
<input type="text" value="{.name}"/>
{#if _canAdmin}
<button class="btn btn-mini" x-bind="click:deleteSong">Delete</button>
{/}
</li>
{/}
@philcockfield
philcockfield / checkbox_controller.coffee
Created October 20, 2012 08:11
Checkbox view-model projection of Derby array property
asArray = (options) ->
_.chain(options).where(checked:true).map((option) -> option.key).value()
module.exports =
###
Sets up the x-bind callback handlers.
Example binding in template:
<input type="checkbox" x-bind="click:checkbox" checked="{.checked}">
@philcockfield
philcockfield / gist:3851206
Created October 8, 2012 07:33
MT.Dialog Element - No Tapped Event
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using TheraPlay.Data;
namespace Namespace
{
public class MyElement : Element
{