Skip to content

Instantly share code, notes, and snippets.

@Khady
Khady / tasks.json
Created May 24, 2020 04:22
vscode dune build task
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build all",
"group": "build",
"type": "shell",
"command": "opam exec -- dune build",
@Khady
Khady / revery.debian
Created May 17, 2020 09:59
Debian file for revery deps
# build me with equivs-build ./revery.debian
# based on https://github.com/revery-ui/revery/wiki/Building-&-Installing#for-ubuntu-you-may-need-these-additional-packages
Section: misc
Priority: optional
Standards-Version: 3.9.2
Package: revery-deps
Version: 20200517
Maintainer: Louis <louis@louisroche.net>
@Khady
Khady / Registration.re
Last active October 9, 2019 21:42
tyxml jsx
open Tyxml;
module Custom = {
let createElement = (~children, ()) => {
Html.txt("ahrefs");
};
};
let template = (~name, ~validation_url) => {
<p>
@Khady
Khady / ppxed-source
Created September 9, 2019 06:46
Use merlin to print an ocaml file after being processed by a ppx
#!/usr/bin/env sh
# A .merlin must be present nearby the file.
# With dune it can be generated by calling `dune build @check`.
FILE="$1"
ocamlmerlin single dump -what ppxed-source -filename "$FILE" < "$FILE" | jq -r '.value' | ocamlformat --name="$FILE" -
@Khady
Khady / dune
Last active May 28, 2019 05:57
(library
(name l)
(modules (:standard \ main))
(flags (:standard -w -33))
(libraries
threads ; must be first
unix
)
(preprocess (pps lwt_ppx ppx_deriving.std)))
@Khady
Khady / config
Created August 22, 2018 09:02
Opam configuration for both sandbox and compilation cache
pre-install-commands:
["opam-bin-cache.sh" "restore" build-id name] {?build-id}
wrap-build-commands: [
["opam-bin-cache.sh" "wrap" build-id] {?build-id}
["%{hooks}%/sandbox.sh" "build"] {os = "linux"}
]
wrap-install-commands: [
["opam-bin-cache.sh" "wrap" build-id] {?build-id}
["%{hooks}%/sandbox.sh" "install"] {os = "linux"}
]
(executable
(name main)
(libraries devkit))
@Khady
Khady / editor-config-reason-ocaml.org
Created April 14, 2018 14:38
Env config to use reason-cli and opam

Proper configuration to use reason-cli and opam

How to properly configure the editor for someone using both ReasonML installed from the reason-cli (which is the recommended way to install reason) and ocaml from opam? This question arries when we are doing both native and bucklescript development.

First thing to remember is that all the editor plugins that really need configuration are based on merlin (as far as I know). More precisely on the ocamlmerlin binary. And they will either take the

@Khady
Khady / pick-theme-from-env.el
Created March 8, 2018 14:29
load emacs theme selected by env variables
(setq-local louis/default-theme (if (window-system) 'doom-molokai 'zenburn))
(setq-local louis/bad-id-theme 'whiteboard)
(let ((count-themes 1)
(louis/themes-ids (make-hash-table :size 30))
(louis/themes-names (make-hash-table :size 30 :test 'equal))
(env-theme-name (getenv "EN"))
(env-theme-id (getenv "EI")))
(mapc
(lambda (theme)
@Khady
Khady / config.fish
Last active February 22, 2018 00:57
Update opam env after each command
function refresh_opam -e fish_postexec;
set cmd (string split " " $argv[1])
if [ $cmd[1] = "cd" ]
eval (opam env --shell=fish --readonly)
end
end