This file contains 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
define('validation', [], function() { | |
return { | |
allPropsSpecifiedMixing: { | |
componentDidMount: function() { | |
var unspecifiedPropKeys = _.difference( | |
_.keys(this.props), | |
_.keys(this.type.propTypes || {}).concat('ref')); | |
if (unspecifiedPropKeys.length) { | |
console.warn('Component ' + |
This file contains 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
void Main() | |
{ | |
var environment = new Environment(30); | |
var composed = DoSomeStuff(); | |
var extracted = composed.RunReader(environment); | |
Console.WriteLine(extracted); | |
} | |
public class Environment { | |
public int Count {get; private set;} |
This file contains 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
// this works | |
let makeImage bytes = | |
match Array.length bytes with | |
| 784 -> Image bytes |> Some | |
| _ -> None | |
// but this does not. The none branch is never used. |
This file contains 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
let solveRPN expression = | |
let foldingFunction stack item = | |
match (stack,item) with | |
| (x::y::xs,"*") -> x * y :: xs | |
| (x::y::xs,"+") -> x + y :: xs | |
| (x::y::xs,"-") -> y - x :: xs | |
| (s,o) -> int o :: s | |
let words (i:string) = i.Split(' ') |> List.ofArray | |
words expression | |
|> List.fold foldingFunction [] |
This file contains 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
type Person = | |
{ _id: System.Guid; age: int; name: string } | |
interface IDocument with | |
member x.tableName() = "People" | |
member x.id() = x._id | |
[<Fact>] | |
let ``insert, read, update, delete a document`` () = | |
// insert | |
let id = System.Guid.NewGuid() |
This file contains 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
euclid.start([{ | |
title: 'Dashboard', | |
route: '/dashboard/:date' | |
entry: function (date) { | |
return [pageComponent, initialProps]; | |
}, | |
exit: function () {}, | |
actions: { | |
showDetail: function (itemId) { | |
return updatedProps; |
This file contains 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 Library1 | |
open NUnit.Framework | |
open FsUnit | |
type IHaveAnAge = | |
abstract age: int | |
type Person = | |
{ name: string; age: int } | |
interface IHaveAnAge with |
This file contains 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
// start of a port of Ristretto/Coffeescript game of life to typescript | |
// http://withouttheloop.com/articles/2013-08-11-coffeescript-gameoflife-ristretto/ | |
class Cell { | |
constructor(public x: number, public y:number) {} | |
} | |
function isNeighbour(c:Cell, x:number, y:number): boolean { | |
return Math.abs(x-c.x) < 2 | |
&& Math.abs(y-c.y) < 2 |
This file contains 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
* A brief history of time | |
* Black Swan | |
* Godel Escher Bach | |
* How not to be wrong | |
* Men of mathematics |
This file contains 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
class Showable a where | |
shw :: a -> String | |
data A = A String | |
data B = B Int | |
instance Showable A where | |
shw (A s) = s | |
instance Showable B where |
OlderNewer