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
// Library code | |
type ReduxAction<Type extends string = string> = { type: Type; payload?: any }; | |
type ActionTemplate<P> = (payload: P) => ReduxAction; | |
type ActionTemplateMap = { [action: string]: ActionTemplate<any> }; | |
type ReduxHandler<State, Payload> = undefined extends Payload | |
? (state: Readonly<State>) => State | |
: (state: Readonly<State>, payload: Payload) => State; | |
type ExtractPayloadMap<T extends ActionTemplateMap> = { | |
[K in keyof T]: T[K] extends ActionTemplate<infer P> ? P : never; | |
}; |
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
#!/usr/bin/env bash | |
# Get the command from arguments | |
arg_str="$*" | |
$arg_str & | |
pid="$!" | |
# Wait for the window to open and grab its window ID | |
winid='' | |
while : ; do |
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
import numpy as np | |
import matplotlib.patches as patches | |
from matplotlib import pyplot as plt | |
T_count = 5 | |
x_count = 7 | |
state_count = 6 | |
state_rows = 2 | |
state_cols = 3 |
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
#!/usr/bin/env bash | |
####################################################################### | |
# | |
# tim-test.sh - UCL CS COMP207P Test Runner | |
# Timur Kuzhagaliyev 2017, https://foxypanda.me/ | |
# Public version 1.1 | |
# | |
####################################################################### | |
# |
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
<html> | |
<head> | |
<title>Two-way Data Binding</title> | |
</head> | |
<body> | |
<input id="input" type="text"> | |
<button id="change">Set value to "Hello"</button> | |
<span>Value: <strong id="value"></strong></span> | |
<script> |
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
import Test.QuickCheck | |
combi:: (Num a, Ord a) => [(a, a)] -> [a] | |
combi [] = [0, 0] | |
combi xs = [sum ys] ++ [sum zs] | |
where ys = [x | (x, y) <- xs, x > y] | |
zs = [y | (x, y) <- xs, x > y] | |
zipWith':: (a -> b -> c) -> [a] -> [b] -> [c] | |
zipWith' f a b = [f (a!!x) (b!!x) | x <- [0 .. len - 1]] |