Skip to content

Instantly share code, notes, and snippets.

Table of Contents

  1. Basic syntax
  2. Flow Examples
  3. Advanced features
  4. Using with existing libraries (flow-typed and libdefs)
  5. Tooling
  6. Try

1. Basics

@andyhd
andyhd / lens.js
Created February 11, 2012 01:48
Javascript Lenses
function lens(get, set) {
var f = function (a) { return get(a); };
f.set = set;
f.mod = function (f, a) { return set(a, f(get(a))); };
return f;
}
var first = lens(
function (a) { return a[0]; },
function (a, b) { return [b].concat(a.slice(1)); }
Sample project for the "Getting started with JavaFX in Clojure" ( https://coderwall.com/p/4yjy1a ) ProTip.
@dyatlov
dyatlov / hb-test.py
Last active April 9, 2020 20:03
OpenSSL heartbeat PoC with STARTTLS support - Python3 version
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
import re
import codecs
@sgr
sgr / workaround_the_iconservices_bug_mavericks.sh
Last active July 25, 2020 11:01
When "com.apple.IconServicesAgent" exhausts CPU resources on Mac OSX mavericks (10.9), you can try following workaround.
#!/bin/sh
mkdir ${TMPDIR}/com.apple.IconServices
@abo-abo
abo-abo / query.sql
Last active September 8, 2020 08:03
Use https://developers.google.com/bigquery/ to select top 100 repos by number of commits
select repository_name, count(repository_name) as pushes, repository_description, repository_url
from [githubarchive:github.timeline]
where type="PushEvent"
and repository_language="Emacs Lisp"
and parse_utc_usec(created_at) >= parse_utc_usec('2014-01-01 00:00:00')
group by repository_name, repository_description, repository_url
order by pushes desc
limit 100
@Folcon
Folcon / clipboard-utils.clj
Created August 24, 2011 11:50
Just a quick clipboard slip/slurp I put together because I didn't find anything similar, don't know if it's useful for anyone but found it invaluable when getting large strings being returned from the repl and sticking the result in an editor for more car
(defn get-clipboard []
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit)))
(defn slurp-clipboard []
(try
(.getTransferData (.getContents (get-clipboard) nil) (java.awt.datatransfer.DataFlavor/stringFlavor))
(catch java.lang.NullPointerException e nil)))
(defn spit-clipboard [text]
(.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) nil))
for i in $HOME/local/*; do
[ -d $i/bin ] && PATH="${i}/bin:${PATH}"
[ -d $i/sbin ] && PATH="${i}/sbin:${PATH}"
[ -d $i/include ] && CPATH="${i}/include:${CPATH}"
[ -d $i/lib ] && LD_LIBRARY_PATH="${i}/lib:${LD_LIBRARY_PATH}"
[ -d $i/lib ] && LD_RUN_PATH="${i}/lib:${LD_RUN_PATH}"
# uncomment the following if you use macintosh
# [ -d $i/lib ] && DYLD_LIBRARY_PATH="${i}/lib:${DYLD_LIBRARY_PATH}"
[ -d $i/lib/pkgconfig ] && PKG_CONFIG_PATH="${i}/lib/pkgconfig:${PKG_CONFIG_PATH}"
[ -d $i/share/man ] && MANPATH="${i}/share/man:${MANPATH}"
@geirsagberg
geirsagberg / tfsa.ts
Created April 20, 2021 12:04
Deno script for impersonating STM SA
#!/usr/bin/env -S deno run --allow-net --allow-read --allow-run
let tfVars: string;
try {
tfVars = Deno.readTextFileSync("./environments/STM.tfvars");
} catch (error) {
console.error(error);
Deno.exit(1);
}
@mitcdh
mitcdh / New Tab (Chrome).applescript
Last active May 11, 2021 10:19
Applescripts for new blank tabs with address bar focused
tell application "Google Chrome"
tell front window
activate
if URL of active tab is not equal to "chrome://newtab/" then
make new tab at end of tabs
end if
end tell
end tell