Skip to content

Instantly share code, notes, and snippets.

View rolandpeelen's full-sized avatar

Roland Peelen rolandpeelen

View GitHub Profile
@rolandpeelen
rolandpeelen / adts.md
Created May 11, 2022 13:01
ADT's presentation - Haskell had best code colors in my little presentation thingy (marp), but read them as psuedocode
paginate
true

ADT's, State Complexity & Boolean Blindness

Or, how to infer complexity using ADT's, and why booleans are evil...


@rolandpeelen
rolandpeelen / foo.sh
Created December 20, 2021 12:20
standard commit message
# This commit, when merged will:
# Upgrade dependencies for X, Y, Z
# Add an X, to do a Y
# Improve a Z, to better A
# :art: - Improving structure / format of the code.'
# :zap: - Improving performance.
# :fire: - Removing code or files.
# :bug: - Fixing a bug.
# :ambulance: - Critical hotfix.

ReasonML 101

In our last post, we went over some of the basic concepts in cryptography. Over the course of the following few sections in this post, we'll do a deep-dive into ReasonML. Not only to explain what it is, but also dive into some of its properties, slightly more advanced topics and why it could be an awesome option for your next Javascript project.

Introduction

Over the course of the past few years there have been two notably big trends in developing with Javascript. The first being that we're realizing dynamic languages are not ideal persé. While there is a good place for them, generally speaking, when applications get larger and more interconnected, they tend to become brittle. There are ways of safeguarding this using tests, but we're only testing for the faults we know of and can easily introduce new bugs because we haven't tested a particular use-case. Even the old 100% coverage doesn't help with that as it merely states 100% of the code has been touched. It doesn't test for bad code or w

/*
* Our 'constructor' (i.e. our functor) is just a container
* of some value a and some value b, with a `get` that wraps
* them in a fixed length array so we can deconstruct it.
*/
// magicalType a b
const magicalConstructor = (a, b) => {
const aVal = a;
const bVal = b;
get = () => [aVal, bVal];
// https://jesseduffield.com/in-react-the-wrong-abstraction-kills-efficiency/
// App.js
import React, { Component } from "react";
import { createStore } from "redux";
import { Provider } from "react-redux";
import CounterSection from "./CounterSection";
import "./App.css";
function counter(state = 0, action) {
switch (action.type) {
failed Building static HTML for pages - 2.306s
ERROR #95313
Building static HTML failed for path "/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
10 | function InvariantError(message) {
import * as React from "react";
import * as Js_exn from "../../node_modules/bs-platform/lib/es6/js_exn.js";
import * as Js_dict from "../../node_modules/bs-platform/lib/es6/js_dict.js";
import * as Js_json from "../../node_modules/bs-platform/lib/es6/js_json.js";
import * as Js_option from "../../node_modules/bs-platform/lib/es6/js_option.js";
import * as ApolloHooks from "../../node_modules/reason-apollo-hooks/src/ApolloHooks.bs.js";
import * as Caml_option from "../../node_modules/bs-platform/lib/es6/caml_option.js";
import * as Empty$TenzirWebsite from "./Empty.bs.js";
open ButtonStyles;
open ApolloHooks;
open Helpers.Option;
module HeaderData = [%graphql
{|
query {
banner(where: {id: "ck42sp0oklhah0b32ryaufi7s"}) {
title @bsDecoder(fn: "toReactString")
subtitle @bsDecoder(fn: "toReactString")
import { lensPath, lensProp, compose } from 'ramda';
// Some new helper functions
const append = item => array => [...(array || []), item];
const findById = id => array => array.find(item => item._id === id);
const sceneLens = lensProp('scene');
const structureLens = lensProp('structure');
const objectsLens = lensProp('objects');
const groupsLens = lensProp('groups');
import { lensPath, view, set, over } from 'ramda';
const objectsLens = lensPath(['scene', 'sceneStructure', 'objects']);
const a = view(objectLens, state); // the state from the earlier examples
/*
[
{
name: "Object 01",
_id: "5d551b1cbaf62dd3efb16662",
_mesh: "5d48270afba5945505e6e9dc",