This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function takeWhile<T>(xs: T[], callback: (x: T, i: number) => boolean): T[] { | |
let acc: T[] = []; | |
xs.some((x, i) => { | |
if (callback(x, i)) { | |
acc.push(x); | |
return false; | |
} else { | |
return true; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export module Singleton { | |
export function create<T>(creator: () => T) { | |
let instance: T = null; | |
return { | |
get Instance() { | |
if (Check.isNullOrUndefined(instance)) { | |
instance = creator(); | |
} | |
return instance; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export module Check { | |
export function isNull(obj: any) { | |
return obj === null; | |
} | |
export function isUndefined(obj: any) { | |
return obj === void 0; | |
} | |
export function isNullOrUndefined(obj: any) { | |
return isNull(obj) || isUndefined(obj); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const GenderRadio = React.createClass({ | |
props: { | |
onChange: React.PropTypes.func.isRequired, | |
checkedIndex: React.PropTypes.number.isRequired | |
}, | |
getInitialState: function () { | |
return { | |
items: [ | |
{ content: (<i className="icon-male"></i>) }, | |
{ content: (<i className="icon-female"></i>) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="./../typings/tsd.d.ts"/> | |
/// <reference path="./../node_modules/rx/ts/rx.all.d.ts"/> | |
import * as Rx from "rx"; | |
import * as Bacon from "baconjs"; | |
let rxstream = new Rx.Subject<string>(); | |
let rxdispatcher = rxstream.do(_ => console.log("rxdo")); | |
rxdispatcher.subscribe(console.log); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Frame = Frame || {}; | |
(function($, _, Backbone, Frame) { | |
var renderTemplate = function(template) { | |
var templateHtml = template.html(); | |
return _.template(templateHtml, {}); | |
}; | |
var renderTemplateWithModel = function(template, model) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if UNITY_STANDALONE_WIN | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Threading; | |
using UnityEngine; | |
using SQLite; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Xml; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using System.Threading; | |
namespace Apartama.Network |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION render_orders_insert( | |
_skeleton_id UUID, | |
_layer_type_id UUID, | |
_previous_layer_type_id UUID, | |
_next_layer_type_id UUID) | |
RETURNS SETOF render_orders AS $$ | |
DECLARE | |
current_render_order render_orders%ROWTYPE; | |
next_render_order render_orders%ROWTYPE; | |
previous_render_order render_orders%ROWTYPE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Data { | |
export interface IMultiKey { | |
[name: string]: string; | |
} | |
export class MultiKeyDictionary<TValue> { | |
private keyNames: string[]; | |
private linkedItems: {}; |