Skip to content

Instantly share code, notes, and snippets.

@pbiggar
pbiggar / cla.md
Last active June 28, 2020 02:23
Dark Inc Contributor License Agreement

The Dark Inc. Software Grant and Corporate Contributor License Agreement ("Agreement")

Thank you for your interest in Dark Inc. ("Dark"). In order to clarify the intellectual property license granted with Contributions from any person or entity, Dark must have a Contributor License Agreement (CLA) on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Dark and its users; it does not change your rights to use your

collect_params : (string, string) list -> string
let collect_params params =
params
(* Collecting parameters #1 - percent encoding *)
|> List.map (\k, v -> (pct_encode_key k, pct_encode v))
(* Collecting parameters #2 - sorted*)
(* TODO sort lexicographically? *)
|> List.sort (\(a, _) (b, _) -> compare a b)
@pbiggar
pbiggar / callback.ml
Created May 31, 2019 00:15
BS-tea set cursor code
let setBrowserPos offset =
Tea.Cmd.call (fun _ ->
(* We need to set this in the new frame, as updating sets the cursor to *)
(* the start of the DOM node. *)
ignore
(Web.Window.requestAnimationFrame (fun _ -> setCursorPosition offset)) ;
() )
@pbiggar
pbiggar / .README.md
Last active May 20, 2020 15:55
using ocamlmerlin inside a docker container

We were able to make Spacemacs connect to ocamlmerlin in a Docker container. It definitely works in Spacemacs, and should work anywhere else. Please comment below if you can't make it work.

opam and ocamlmerlin are copies of the same file. ocp-indent, refmt, and other executables can be handled the same way.

The magic happens in run-in-docker. You most likely need to change the sed commands in fix_dirs_stdin and fix_dirs_stdout.

I've included a sample Dockerfile that we use with 4.04.2, note the env vars are important.

module Bitwise (bw) where
import Data.Bits((.&.), bit, testBit)
bw :: Int -> Int -> Int
bw l r = bwf l r 63 0
bwf :: Int -> Int -> Int -> Int -> Int
bwf l r 0 accum = accum
bwf l r i accum
@pbiggar
pbiggar / enex2md.clj
Last active January 8, 2016 16:18
enex to markdown
;;; This script by Paul Biggar, available at https://gist.github.com/pbiggar/6323088a31d689c61a24
;;;
;;; This converts Evernote files into plaintext (not really markdown), so you can move your stuff out of evernote into a markdown editor.
;;;
;;; First, export your Evernotes, using File -> export notes. Export them into "My Notes.enex".
;;; copy this file into the same direcory as "My Notes.enex".
;;;
;;; To run this file, you'll need some dependencies, but they should only take a moment to install.
;;; leinigen: On OSX, use "brew install leiningen".
;;; lein-exec: From the terminal, run `mkdir ~/.lein; echo '{:user {:plugins [[lein-exec "0.3.5"]]}}' > ~/.lein/profiles.clj
@pbiggar
pbiggar / up-and-running.md
Last active January 31, 2017 10:27
Getting your CircleCI builds up and running again

In order to get your builds working again, we need to reauthenticate with GitHub and other services used in your build.

Logging in

When you log in to CircleCI via GitHub's OAuth, we get an API key to call the GitHub API, update the GitHub commit status, list your projects on the add projects page, etc.

We revoked all OAuth tokens to protect your GitHub repositories. The first time you log in to Circle, you'll have to reauthenticate the Circle GitHub application to get a new token.

The checkout phase

CookieBot = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cook as fast as possible!
$("#bigCookie").click();
}, 1);
this.buyInterval = setInterval(function(){
// Sometimes a golden cookie will appear to give you a bonus
// Click that too!
$("#goldenCookie").click();
@pbiggar
pbiggar / gist:3166676
Created July 23, 2012 22:35
Sample circle.yml file
########################
# Customize the test machine
########################
machine:
# Set the timezeone - any value from /usr/share/zoneinfo/ is valid here
timezone:
America/Los_Angeles
# Version of ruby to use
$ brew install htop
/usr/local/bin/git
==> Cloning git://github.com/cynthia/htop-osx.git
Updating /Users/pbiggar/Library/Caches/Homebrew/htop--git
==> ./autogen.sh
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/htop/HEAD
==> make install DEFAULT_INCLUDES='-iquote .'
/usr/bin/make install-am
make: *** No rule to make target `.''. Stop.
make: *** Waiting for unfinished jobs....