Skip to content

Instantly share code, notes, and snippets.

View arnarthor's full-sized avatar

Arnar Þór Sveinsson arnarthor

View GitHub Profile

Keybase proof

I hereby claim:

  • I am arnarthor on github.
  • I am arnarthor (https://keybase.io/arnarthor) on keybase.
  • I have a public key ASAGye_bfg6S-1ulv7Nu2sxysARpVbopzbM7wN1moKY0RQo

To claim this, I am signing this object:

Reason

I have heard a lot of complaints about lack of editor integration or flaky editor tooling in the Reason community. At my previous job we had ~3000 modules and ~80k LOC. I'll admit that we were not very vigilant with .rei files or keeping our inter module dependencies really clean so this slowed both bsb and especially reason-language-server down a lot.

In fact so much that people couldn't use reason-language-server anymore on 15" MacBook Pros.

I myself have always used a Merlin based setup since I joined the Reason eco system before reason-language-server, and in our project my setup had never failed. Therefor I went on a quest of setting up 3 of the major editors (Emacs, Vim and VSCode) and documenting how to get them working

open Belt;
let randomlyFailedPromise = () => {
let random = Js.Math.random();
Js.Promise.make((~resolve, ~reject as _) =>
resolve(.
if (random > 0.5) {
Result.Error(`NumberToHigh);
} else {
Result.Ok(random);

Install opam brew install opam

Switch to correct compiler (using Bucklescript 5.x would be OCaml 4.02.3) opam switch create 4.02.3

Using merlin with Reason globally installed via opam opam install reason opam install merlin

var amplitude = require('amplitude-js');
var apiKey;
exports.init = function init(key) {
apiKey = key;
amplitude.getInstance(apiKey).init(apiKey);
};
exports.client = amplitude;
exports.logEventWithUserProperties = function logEventWithUserProperties(
let component = ReasonReact.statelessComponent("IconVideo");
let make = (~className, ~shapeClassName, _children) => {
...component,
render: (_) =>
<svg className viewBox="0 0 18 21" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g className=shapeClassName transform="translate(-454.000000, -130.000000)">
<g transform="translate(362.000000, 125.000000)">
<path
[@bs.module "react-router-dom"] external browserRouter : ReasonReact.reactClass = "BrowserRouter";
[@bs.module "react-router-dom"] external route : ReasonReact.reactClass = "Route";
[@bs.module "react-router-dom"] external link : ReasonReact.reactClass = "Link";
[@bs.module "react-router-dom"] external navLink : ReasonReact.reactClass = "NavLink";
[@bs.module "react-router-dom"] external _switch : ReasonReact.reactClass = "Switch";

Keybase proof

I hereby claim:

  • I am arnarthor on github.
  • I am arnarthor (https://keybase.io/arnarthor) on keybase.
  • I have a public key ASBPfUISXao85cvvy1EVTQnaXtf0GXg9XUOUj4KhPf-UTgo

To claim this, I am signing this object:

const express = require('express');
const cars = [{type: 'Nissan', model: 2016}, {type: 'Nissan', model: 2015}, {type: 'Toyota', model: 2016}, {type: 'Kia', model: 2016}]
const punches = [{count: 5, name: 'Arnar'}, {count: 6, name: 'Daníel'}, {count: 10, name: 'Axel'}];
const app = express();
app.get('/goodCarFilter/:year', (req, res) => {
const filteredCars = cars.filter((car) => {
return car.model === parseInt(req.params.year);
})
/* @flow */
import _ from 'lodash';
import React, {Component} from 'react';
import makeDebug from 'debug';
import styles from './index.css';
const debug = makeDebug('component:SpeechRecognition');
type Props = {