Skip to content

Instantly share code, notes, and snippets.

View rlucha's full-sized avatar

Rob Lucha rlucha

View GitHub Profile
@henrebotha
henrebotha / instructions.md
Last active March 30, 2024 22:37
Karabiner Elements: Caps Lock + I/J/K/L to Arrow Keys (a la Pok3r)

Instructions

  1. Install Karabiner Elements
  2. Open your karabiner.json file (it will be in ~/.config/karabiner/karabiner.json).
  3. Find complex_modifications. It will have a key rules that takes a list ("rules": [...]).
  4. Inside the square brackets, paste this:
{
    "description": "Change Caps Lock + I/J/K/L to Arrow Keys",
@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created November 24, 2017 18:41
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
@kritzcreek
kritzcreek / Post.md
Last active January 20, 2019 22:42
Teaching Polymorphism

"Is Haskell a good first programming language?"

This question was asked at the recent HaskellX conference, with both practicioners as well as teachers being present. I won't reiterate everything that was said, and instead link to a recording of the podium discussion (https://skillsmatter.com/skillscasts/10952-park-bench-panel-session-with-haskellx-experts).

One particular argument, that I've heard come up multiple times now, is that teachers are complaining about the length function being polymorphic. Apparently length :: forall a. Foldable f => f a -> Int is hard to grasp/understand/accept for a new-comer. The solutions proposed to solve this problem are to:

  1. Return length to its non-Foldable type
  2. Use a custom Prelude to teach beginners

Drawbacks for 1 include that practicioners like the fact that length works for all kinds of data structures, and don't want that taken away from them. The primary problem with solution 2 is that students can't go and use their aquired knowledge to work on Open

@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.

import React, { Component } from 'react';
import { graphql } from 'react-apollo';
import { gql } from 'graphql-tools';
const QUERY = gql`
query MatchesByDate($date: Int) {
matches(date: $date) {
id
minute
period
@stereobooster
stereobooster / Readme.md
Last active December 4, 2018 03:28
setTimeout, setImmediate, requestAnimationFrame, PostMessage, MutationObserver, etc
@macbookandrew
macbookandrew / findStyles.js
Last active March 30, 2024 15:24
List unique CSS properties for all DOM elements
/**
* List unique CSS properties for all DOM elements
* Initially created to list unique font stacks on a page
* @see {@link http://stackoverflow.com/a/35022690/ Inspired by this StackOverflow answer}
*
* @see {@link https://gist.github.com/macbookandrew/f33dbbc0aa582d0515919dc5fb95c00a/ URL for this file}
*
* @author AndrewRMinion Design (https://andrewrminion.com)
* @version 1.1
*
@so0k
so0k / kubectl.md
Last active April 25, 2024 12:40
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no

Parser

  • /src/parser/spider_monkey_ast.ml: The type definitions for the AST. Tries to stay very close to ESTree
  • /src/parser/lexer_flow.mll: The ocamllex lexer logic
  • /src/parser/parser_flow.ml: The recursive descent JS parser

Inference

  • /src/typing/type_inference_js.ml: Contains the "entry point" for inference (Function called infer_ast).
  • /src/typing/statement.ml: Most of the inference logic (runs through the AST and generates the initial constraints)
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents