Skip to content

Instantly share code, notes, and snippets.

View toan2406's full-sized avatar
🥕

Toan Nguyen toan2406

🥕
  • Ho Chi Minh city, Vietnam
View GitHub Profile
'use strict';
const {dirname, isAbsolute, join, resolve} = require('path');
const {existsSync} = require('fs');
const {PassThrough} = require('stream');
const inspectWithKind = require('inspect-with-kind');
const npmCliDir = require('npm-cli-dir');
const optional = require('optional');
const resolveFromNpm = require('resolve-from-npm');
let str = ReasonReact.string;
let url = "http://localhost:3000/users";
type user = {
id: int,
name: string,
};
type state =
@busypeoples
busypeoples / PhantomTypeReasonML.md
Last active February 6, 2024 21:29
Phantom types in ReasonML

Phantom types in ReasonML

Introduction

"A phantom type is a parametrised type whose parameters do not all appear on the right-hand side of its definition..." Haskell Wiki, PhantomType

The following write-up is intended as an introduction into using phantom types in ReasonML.

Taking a look at the above definition from the Haskell wiki, it states that phantom types are parametrised types where not all parameters appear on the right-hand side. Let's try to see if we can implement a similar example as in said wiki.

@comigor
comigor / circle-install-android.sdk.sh
Last active November 21, 2022 16:41
Install Android SDK on a CircleCI OSX machine
#!/bin/bash
# from https://gist.github.com/Igor1201/5036401727a9c178193b1e0688e1eb3c
set -eo pipefail
export ANDROID_HOME="/usr/local/share/android-sdk"
export PATH="$PATH:$ANDROID_HOME/tools/bin"
# set variables
ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip"
ANDROID_SDK_SHA="4a81754a760fce88cba74d69c364b05b31c53d57b26f9f82355c61d5fe4b9df9"
@jfmengels
jfmengels / lodash-fp-documentation.md
Last active July 25, 2024 05:02
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs
@branneman
branneman / javascript-duck-typing.js
Last active January 22, 2021 20:56
JavaScript Duck typing vs. Interfaces
// Factory
var encrypterFactory = function(config) {
var encrypter = eval('new Encrypt' + config.algorithm.toUpperCase());
if (typeof encrypter.encrypt !== 'function') {
throw new Error(encrypter.constructor.name + ' must implement the `encrypt` method!');
}
return encrypter;
};
// Implementations