Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Fedoseev alexfedoseev

View GitHub Profile
View Promise.md

Promise.res

A slightly modified version of standard ReScript's Js.Promise module.

Key differences are:

  • t-first api
  • contains few helpers like Promise.result and Promise.wait (which is what I want most of the time in apps)

Soundness is on the same level as in the original bindings.

If you want more safety, consider reason-promise.

View jest+bucklescript.md
  1. Install these packages:
yarn install --dev @babel/core @babel/preset-env jest babel-jest
  1. Add babel.config.js (exactly babel.config.js, not .babelrc, not .babelrc.json etc):
module.exports = {
View ReactTransitionGroup.re
type transitionHook = Dom.htmlElement => unit;
module type Css = {
let duration: int;
let appear: string;
let enter: string;
let exit: string;
let appearActive: string;
let enterActive: string;
let exitActive: string;
View Promise.re
open Belt;
type t(+'a) = Js.Promise.t('a);
type error = Js.Promise.error;
type result('ok, 'error) = t(Result.t('ok, 'error));
[@bs.new]
external make:
(
View Cookie.re
View Promise.re
open Belt;
type t(+'a) = Js.Promise.t('a);
type error = Js.Promise.error;
type result('ok, 'error) = t(Result.t('ok, 'error));
external errorToString: error => string = "%identity";
[@bs.new]
View App.re
<TextField
icon=(module IconOk)
value
onChange=change
/>
View ReactDayPicker.re
module Modifier = {
type t =
| Date(Js.Date.t)
| Range(Js.Date.t, Js.Date.t)
| Fn(Js.Date.t => bool);
let toJs =
(. x) =>
switch (x) {
| Date(date) => date
View Promise.re
let all = Js.Promise.all;
let resolve = Js.Promise.resolve;
let reject = Js.Promise.reject;
let andThen =
(p: Js.Promise.t('a), fn: 'a => Js.Promise.t('b)): Js.Promise.t('b) =>
p->Js.Promise.then_(fn, _);
View ssl_smtp_example.go
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
You can’t perform that action at this time.