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
{-# LANGUAGE TypeFamilies, FlexibleContexts #-} | |
type Position = (Int, Int) | |
newtype PlayerData = PlayerData { _pos :: Position } | |
data GameStateData = GameStateData PlayerData [Position] | |
-- player typeclass and instance | |
class Player p where |
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
'use strict'; | |
// Usage | |
// node check-markdown-links.js path/to/markdown/file.md | |
// What it does: | |
// - Warns when `[ref][]` or `[title][ref]` style links don't have references defined on a page | |
// - Warns when `[ref]: URL` reference is not used anywhere | |
// - Warns when two `[ref]: URL` references point to same `URL` | |
// - Warns when `[ref]: URL` reference is defined in non-lexical order |
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 function that takes an instance of `T` and returns a nullable `T?` | |
fun <T>toNullable(t: T): T? { | |
return t | |
} | |
// If we pass in a `String`, we get back a `String?` | |
val s1 : String? = toNullable("" as String) | |
// So, if we pass in a `String?`, we get back a nested nullable `String??`, right? | |
// Wrong. We get a `String?` |
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
// Testing a service with no dependencies | |
it('description', inject(function(myService) { | |
expect(myService).to.work.dammit; | |
})); | |
// Setting up some test doubles (`dependency` and `dependency2`) | |
it('description2', function() { | |
module({ | |
dependency: { | |
property: 'hello', |
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 Main where | |
import Prelude | |
import Control.Monad.Eff.Console | |
import Data.Foldable (foldMap) | |
import TryPureScript | |
type Option a = forall b. (a -> b) -> b -> b |
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
-- npm i xhr2 --save | |
import Prelude | |
import Control.Monad.Aff | |
import Control.Monad.Eff.Console | |
import Network.HTTP.Affjax | |
void $ runAff logShow (\x -> log x.response) (get "https://httpbin.org/ip" :: Affjax (console :: CONSOLE) String) | |
void $ runAff logShow (\x -> log (x.response :: String)) (get "https://httpbin.org/ip") |
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
/** | |
* Using Interactive Extensions Async / Ix-Async | |
* https://www.nuget.org/packages/Ix-Async/ | |
* https://github.com/Reactive-Extensions/Rx.NET | |
*/ | |
var tasks = Enumerable.Range(0, 10).Select(i => Task.Run(() => | |
{ | |
Debug.WriteLine("evaluating " + i); |
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
// https://dotnetfiddle.net/INhbdg | |
public static class EnumerableEx | |
{ | |
public static IEnumerable<TReturn> ZipAll<T1, T2, TReturn>( | |
this IEnumerable<T1> first, | |
IEnumerable<T2> second, | |
Func<T1, T2, TReturn> f, | |
T1 seed1, | |
T2 seed2) |
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
[NUnit.Framework.TestAttribute] | |
public void $TestMethodName$() | |
{ | |
$END$ | |
} |
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
PREFIX="SVC-41+2: " | |
ORIG_MSG_FILE="$1" | |
T="/tmp/git-temp-commit-msg" | |
(printf "%s" "$PREFIX"; cat "$ORIG_MSG_FILE") > "$T" | |
cat "$T" > "$ORIG_MSG_FILE" |