Skip to content

Instantly share code, notes, and snippets.

View dstrekelj's full-sized avatar

Domagoj Štrekelj dstrekelj

View GitHub Profile
@Avaq
Avaq / combinators.js
Last active July 15, 2024 14:46
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
function turn (X, Y) {
// for the math, see http://www.texpaste.com/n/ev3443eo
var
X2 = X*X, Y2 = Y*Y,
q = 1 + X2 + Y2,
s = 1 - X2 - Y2,
r2 = 1/(q*q), s2 = s*s,
A = (s2 + 4*(Y2 - X2))*r2, B = -8*X*Y*r2, C = 4*s*X*r2,
D = (s2 + 4*(X2 - Y2))*r2, E = 4*s*Y*r2,
F = (s2 - 4*(X2 + Y2))*r2;
@mfd
mfd / gotham.md
Last active July 25, 2024 19:46
Gotham font
https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css

<link rel="https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css">

@abdullah353
abdullah353 / .gitlab-ci.yml
Created July 15, 2017 11:20
Basic skeleton of Gitlab CI integration with AWS Lambda for auto deployments.
image: docker:latest
before_script:
- apt-get update -y # Updating the Ubuntu Docker instance.
- python -V # Print out python version for debugging.
- apt install -y zip jq
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH # Required for awscli.
- aws --version # Print out aws cli version for debugging.
@manzoorwanijk
manzoorwanijk / yup-with-final-form.js
Last active July 25, 2024 21:04
How to properly use yup validation schema with (React) Final Form?
import * as yup from 'yup';
import { setIn } from 'final-form';
const validationSchema = yup.object({
email: yup.string().email(),
shipping: yup.object({
name: yup.string(),
phone: yup.object({
code: yup.string().matches(/^\+\d+$/i),
number: yup.number().max(10),