Skip to content

Instantly share code, notes, and snippets.

View rizo's full-sized avatar

Rizo I rizo

  • London, UK
View GitHub Profile
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active April 22, 2024 16:22
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion:

@Hirrolot
Hirrolot / CoC.ml
Last active March 5, 2024 09:47
Barebones lambda cube in OCaml
(* The syntax of our calculus. Notice that types are represented in the same way
as terms, which is the essence of CoC. *)
type term =
| Var of string
| Appl of term * term
| Binder of binder * string * term * term
| Star
| Box
and binder = Lam | Pi
@evancz
evancz / ocaml.elm
Last active December 13, 2023 16:06
Syntax Hints (OCaml -> Elm)
module Hints exposing (..)
import List
import Html exposing (..)
import Html.Attributes as A
{-----------------------------------------------------------
SYNTAX HINTS (OCaml -> Elm)
module Int64Array : sig
module Array : sig
type t
val create_uninitialised : int -> t
val get : t -> int -> int64
val set : t -> int -> int64 -> unit
val unsafe_get : t -> int -> int64
val unsafe_set : t -> int -> int64 -> unit
end
end = struct
@ryyppy
ryyppy / 0_README.md
Last active May 8, 2020 11:29
ReasonReact useReducer example with a loading component

ReasonReact + useReducer hooks

This Gist is based on a tweet & blog post by Prateek Pandey on how to use a record based reducerComponent with ReasonReact : https://blog.theporter.in/reason-react-component-29fbffd784d6

It's based on the old record API, so I wanted to make an example which uses the newest ReasonReact API which is based on React hooks. IMO the hooks based API is much more lightweight and easier to understand. You can find more infos about it in the official ReasonReact docs.

Below you will find a similar solution to the Loadable state tracking as described in the blog post. The first example shows state tracking via a reducer (useReducer), the second example shows a more simplistic version with useState (the one I would prefer for this sp

An introduction to alternative keyboard layouts

This is a post to satisfy your curiosity about alternative keyboard layouts, why some people use them, and whether they're for you. It is intended to discuss the topic in broad terms, but I will share my personal preferences towards the end. Due to time constraints and my own limited knowledge, I will focus on layouts optimized for the English language (ANSI variants, with an occasional nod to ISO).

First off, it's important to understand how much debate there is about how we got here: I will not even attempt to settle the issue of who invented the 'first' typewriter layout, because the modern device had many predecessors going back centuries. The usual legend of typewriter evolution holds that American Christopher Latham Sholes debuted the typewriter in 1868 with a 2-row layout that was (nearly) alphabetical. A horizontal stagger between the rows made room for the lever arms attached to each key:


 3 5 7 9 N O P Q R S T U V W X Y Z
2 4 6 8 . A B C D E
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 5, 2024 22:32
Swift Concurrency Manifesto
@rneswold
rneswold / lwt_fstream.ml
Last active November 4, 2021 21:20
Functional streams for LWT
open Lwt.Infix
exception Source_terminated
type 'a node = N of ('a * 'a node Lwt.t)
type 'a t = 'a node Lwt.t
let push ref_waker v =
let new_node, new_waker = Lwt.wait () in
@itod
itod / split_keyboards.md
Last active April 28, 2024 19:44
Every "split" mechanical keyboard currently being sold that I know of
#include <stdio.h>
typedef struct {
int tag;
union {
int l;
struct {
char* fst;
float snd;
} r;