Skip to content

Instantly share code, notes, and snippets.

@ApprenticeGC
ApprenticeGC / create-card-test.fs
Last active October 10, 2017 08:28
TDD of 6 Nimmt in Expecto
let tests =
testList "遊戲主體規則" [
testList "卡牌生成規則" [
test "生成後共有一零四張牌" {
let expected = 104
let actual = cardRepo |> List.length
Expect.equal actual expected "生成後的牌數應為一零四張"
}
test "生成後的每一張牌為連號" {
let expected = seq { for i in 1 .. 104 do yield i } |> Seq.toList
@ApprenticeGC
ApprenticeGC / basic-query.graphql
Last active October 3, 2017 10:02
Some grapnel query
query {
viewer {
login
}
}
@ApprenticeGC
ApprenticeGC / sample-dialog.json
Created October 3, 2017 08:43
Sample dialog for using in merging chars
{
"id": "c5661e72-d646-4112-ac0e-eb04387d8bd8",
"content": "泠色初澄一帶煙,幽聲遙瀉十絲弦。長來枕上牽情思,不使愁人半夜眠。"
}
@ApprenticeGC
ApprenticeGC / cardType.fs
Last active September 20, 2017 07:18
Continue to make Crazy Eights game after reading blog.
type Suit = Spades | Hearts | Clubs | Diamonds
type Rank = Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King | Ace
type Card = Rank * Suit
@ApprenticeGC
ApprenticeGC / retrieve-sample-blog.js
Created September 4, 2017 10:04
Retrieve sample blog from Contentful
const contentful = require('contentful')
const chalk = require('chalk')
// const Table = require('cli-table2')
const argv = require('yargs').argv
const Rx = require('rxjs/Rx')
const Observable = require('rxjs/Observable').Observable
const spaceId = argv.spaceId
const accessToken = argv.accessToken
@ApprenticeGC
ApprenticeGC / sample-by-async-index.js
Created September 3, 2017 14:12
Rewrite Contentful sample in rxjs and async/await
const contentful = require('contentful')
const chalk = require('chalk')
const Table = require('cli-table2')
const argv = require('yargs').argv
const Rx = require('rxjs/Rx')
const Observable = require('rxjs/Observable').Observable
const spaceId = argv.spaceId
const accessToken = argv.accessToken
@ApprenticeGC
ApprenticeGC / set-in-references.sh
Created July 7, 2017 01:39
Speed up development in Unity using some tricks.
# unlink first
if [ -L "$(pwd)/Assets/Plugins/UniRx.dll" ] ; then
unlink "$(pwd)/Assets/Plugins/UniRx.dll"
fi
if [ -L "$(pwd)/Assets/Plugins/Zenject" ] ; then
unlink "$(pwd)/Assets/Plugins/Zenject"
fi
if [ -L "$(pwd)/Assets/Plugins/Zenject.meta" ] ; then
@ApprenticeGC
ApprenticeGC / CameraController.fs
Last active June 24, 2017 21:30
Unity sample project, roll-a-ball F# version
namespace RollABall
open UnityEngine
type CameraController() =
inherit UnityEngine.MonoBehaviour()
[<DefaultValue>] val mutable player : GameObject
let mutable offset : Vector3 = Unchecked.defaultof<Vector3>
@ApprenticeGC
ApprenticeGC / LoggerFromUniRx.cs
Created May 11, 2017 09:33
Combine UniRx with Loggly
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UniRx;
public class LoggerFromUniRx : MonoBehaviour
{
private class LogCallback
{
@ApprenticeGC
ApprenticeGC / SceneInstaller.cs
Last active April 19, 2017 22:56
Try to use Akka .Net in Unity 2017 beta version
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Akka;
using Akka.Actor;
namespace GiantCroissant.UseAkka.Game
{
public class Greet