Skip to content

Instantly share code, notes, and snippets.

View sleexyz's full-sized avatar

Sean Lee sleexyz

View GitHub Profile
@pesterhazy
pesterhazy / building-sync-systems.md
Last active October 6, 2024 16:49
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@oxalica
oxalica / flake.nix
Created January 16, 2021 14:49
Rust wasm example development environment
{
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
flake-utils.url = github:numtide/flake-utils;
rust-overlay.url = github:oxalica/rust-overlay;
};
outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
pkgs = import nixpkgs {
#!/bin/bash
if [[ $# -lt 2 ]]; then
echo "Usage: $0 <depfile> <command...>" >&2
exit 1
fi
# The .d file we're going to write.
DEPSFILE=$1
shift
@neilalexander
neilalexander / example.go
Created January 9, 2019 22:44
macOS/iOS: Writing to NSLog using Golang (using Cgo)
package myapp
import "log"
...
mobilelog := MobileLogger{}
logger := log.New(mobilelog, "", 0)
@vjeux
vjeux / x.md
Last active January 6, 2024 07:15
Ocaml / functional programming

I'm taking down this post. I just posted this as a side comment to explain a sentence on my latest blog post. This wasn't meant to be #1 on HN to start a huge war on functional programming... The thoughts are not well formed enough to have a huge audience. Sorry for all the people reading this. And please, don't dig through the history...

#include "cinder/app/App.h"
#include "cinder/app/RendererGl.h"
#include "cinder/gl/gl.h"
#include "cinder/Surface.h"
#include "cinder/gl/Texture.h"
#include "cinder/Utilities.h"
#include "cinder/qtime/QuickTimeGl.h"
using namespace ci;
@b-studios
b-studios / 01.README.md
Last active November 23, 2020 22:58
Syntactic sugar for step-by-step annotated functions in pointfree style

When defining complex functions in pointfree style, I often find myself switching to pointful style. Sometimes, I even convert to ANF and annotate the types to understand the steps.

After completing the function definition, I often convert back to pointfree style for conciseness. End of the story: To understand it again a couple of weeks later, I start expanding to annotated pointful again.

The small 10-lines library at the end of this post allows to define pointfree functions with intermediate type annotations.

Credits: Agda and EqReasoning for syntactical inspiration.

@nmn
nmn / FunctionValue.ts
Last active November 3, 2017 12:25
Magic Flow Type 1: $FunctionXValue —— A magic flow type that takes a function type that takes one arg, the type of that arg, and returns the return value type of the function.
/* @flow */
type $Function1<A, B> = (arg: A) => B;
type _Function1Value<A, B, F: $Function1<A, B>> = B; // eslint-disable-line
type $Function1Value<F: $Function1<*, *>, A> = _Function1Value<A, *, F>;
var toString = (value) => String(value)
var toNumber = (value) => parseFloat(value) || 0
type NumberXString = ((value: number) => string) & ((value: string) => number)
@amalex5
amalex5 / ThreeFunThingsAboutHaskell.md
Last active March 21, 2018 19:08
Three Fun Things About Haskell

Three Fun Things About Haskell

###Andrew Alexander

A loose transcription of an impromptu five-minute presentation at the Recurse Center, 5 May 2016

##Pattern-matching

(I don't think "pattern matching" is a great name, but this is what everyone calls it.) Anyway, in normal programming, you define a function exactly ONCE, and if you need it to behave differently depending on what its input is, you have to write if-then branches or switch or case statements, and things can get very ugly very fast.