Skip to content

Instantly share code, notes, and snippets.

View zerobias's full-sized avatar
💭
Set your status

Dmitry zerobias

💭
Set your status
View GitHub Profile
@briancavalier
briancavalier / type-nat.js
Last active August 19, 2018 02:02
Flow type-level naturals and addition
// @flow
// Type-level naturals
type Zero = 0
interface Succ {
<N>(N): [1, N]
}
// Hey look, we can do type-level pattern matching
@akiellor
akiellor / Dockerfile.flowtype-dev
Last active March 1, 2018 02:46
Flow performance degradation bisect scripts
FROM ubuntu
WORKDIR /data
RUN apt-get update -y
RUN apt-get install -y git opam m4
RUN yes | opam init --comp 4.03.0
RUN git clone https://github.com/facebook/flow.git /data
RUN yes | opam update
RUN yes | opam pin add -n flowtype .
@zerobias
zerobias / flow-ignore.js
Last active June 20, 2018 06:27
Make flow ignore all unrelated deps and work much faster
//@flow
const {
readdirSync,
outputFileSync,
pathExistsSync,
//$todo
readFileSync,
} = require('fs-extra')
@sebmarkbage
sebmarkbage / Infrastructure.js
Last active May 2, 2024 03:11
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
import { right, either, left } from 'fp-ts/lib/Either'
import { HKTAs, HKT2As, HKT2, HKTS, HKT, HKT2S } from 'fp-ts/lib/HKT'
import { Monad } from 'fp-ts/lib/Monad'
import { option, some } from 'fp-ts/lib/Option'
function Do<M extends HKT2S>(m: Monad<M>): <L, A>(generator: () => Iterator<HKT2<M, L, A>>) => HKT2As<M, L, A>
function Do<M extends HKTS>(m: Monad<M>): <A>(generator: () => Iterator<HKT<M, A>>) => HKTAs<M, A>
function Do<M extends HKTS>(m: Monad<M>): <A>(generator: () => Iterator<HKT<M, A>>) => HKT<M, A> {
return <A>(generator: () => Iterator<HKT<M, A>>): HKT<M, A> => {
const iterator = generator()
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active May 22, 2024 13:44
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Error codes

According to Webogram (And TDesktop a bit)

  • 400 -- Bad request (Almost all errors)
  • 401 -- Unauthorized
  • 403 -- Forbidden
  • 404 -- Not found
  • 406 -- Network
  • 420 -- Flood
  • 500 and greater -- "Temporary" errors
@stek29
stek29 / 0readme.md
Last active April 11, 2022 17:59
proof of concept
git clone https://github.com/grishka/libtgvoip.git
cd libtgvoip
# Build openssl-1.0.1 and opus-1.1 to prefix libraries/
# Save CMakeLists.txt here (in repo root)
mkdir build
cd build
# Save CallMakefile and main.cpp here
@kana-sama
kana-sama / haskell.json
Last active July 19, 2021 14:11
List of snippets for vscode for Haskell Unicode functions and tokens
{
"α": { "body": "α", "prefix": "\\alpha" },
"β": { "body": "β", "prefix": "\\beta" },
"γ": { "body": "γ", "prefix": "\\gamma" },
"δ": { "body": "δ", "prefix": "\\delta" },
"ζ": { "body": "ζ", "prefix": "\\zeta" },
"η": { "body": "η", "prefix": "\\eta" },
"θ": { "body": "θ", "prefix": "\\theta" },
"ι": { "body": "ι", "prefix": "\\iota" },
"κ": { "body": "κ", "prefix": "\\kappa" },
@DrBoolean
DrBoolean / representable.js
Last active December 24, 2020 00:15
Representable Functors
const Immutable = require('immutable-ext')
const {Just, Nothing} = require('data.maybe')
const Task = require('data.task')
// Setup
const Reader = f =>
({
run: f,
map: g => Reader(x => g(f(x))),