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
-- http://www.randomhacks.net.s3-website-us-east-1.amazonaws.com/2007/02/08/haskell-queues-without-pointers/ | |
{-# OPTIONS_GHC -Wall #-} | |
module Queue where | |
-- A queue holding values of type 'a'. | |
data Queue a = Queue [a] [a] | |
deriving (Show) | |
-- Create a new queue. |
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
<?php | |
declare(strict_types=1); | |
function uppercaseWordsImperative(array $words): void { | |
foreach ($words as $word) { | |
$word = strtoupper($word); | |
echo $word.' '; | |
} | |
} |
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
<?php | |
declare(strict_types = 1); | |
namespace FFW\Container; | |
class Digraph | |
{ | |
public const SOURCE_VERTEX = 'Source Vertex'; | |
/** @var 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
<?php | |
//////////////////////////////////////////////////////////////// | |
// compose = foldl (.) id | |
//////////////////////////////////////////////////////////////// | |
function curry(callable $fn, ...$args): \Closure { | |
return function (...$partialArgs) use ($fn, $args) { | |
$args = array_merge($args, $partialArgs); | |
$numRequiredArgs = (new \ReflectionFunction($fn)) |
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
1. Install MacTeX: | |
brew cask install Caskroom/cask/mactex | |
2. Download LaTeXiT: | |
https://www.chachatelier.fr/latexit/latexit-downloads.php?lang=en | |
3. Write LaTeX code, press "LaTeX it!" and copy&paste the result into Keynote. |
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
# You will first need to install highlight: | |
# brew install highlight | |
function keynote-code-hl --argument-names 'syntax' | |
if test -n "$syntax" | |
pbpaste | highlight \ | |
--syntax=$syntax \ | |
--font Menlo \ | |
--font-size 24 \ | |
--style anotherdark \ | |
--out-format rtf \ |
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
<?php | |
// This would be a type class in Haskell. | |
// Any type that implements this interface/type class is a Functor. | |
interface Functor { | |
// map() takes a function and returns a Functor. | |
// The "Functor F" before the "=>" simply means that F implements Functor. | |
// map :: Functor F => (a -> b) -> F b | |
public function map(callable $fn); | |
} |
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
#!/bin/bash | |
# --------------------------------------------------------- | |
# Customizable Settings | |
# --------------------------------------------------------- | |
# where to store the sparse-image | |
WORKSPACE=${HOME}/.workspace.dmg.sparseimage | |
# location where workspace will be mounted |
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'; | |
const Foo = (() => { | |
const params = new WeakMap(); | |
class Foo { | |
constructor(bar, baz) { | |
params.set(this, { | |
'barKey': bar, | |
'bazKey': baz |
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 | |
PUML_RELATIVE_WORKING_DIR="diagrams/" | |
PUML_BIN=$(which plantuml 2>/dev/null) | |
######## | |
set -u # exit on unset var | |
set -e # exit on non-true return value | |
cd $(dirname ${BASH_SOURCE[0]})/.. # change to project root for relative paths |