Skip to content

Instantly share code, notes, and snippets.

View vvatikiotis's full-sized avatar

Bill Vatikiotis vvatikiotis

View GitHub Profile
@yelouafi
yelouafi / algebraic-effects-series-2.md
Last active April 19, 2023 08:20
Capturing continuations with Generators

Algebraic Effects in JavaScript part 2 - Capturing continuations with Generators

This is the second part of a series about Algebraic Effects and Handlers.

Note: initially I planned a 3-part series, but since the current post on undelimited continuations ended up taking

@yelouafi
yelouafi / algebraic-effects-series-1.md
Last active February 24, 2024 16:03
Operational Introduction to Algebraic Effects and Continuations

Algebraic Effects in JavaScript part 1 - continuations and control transfer

This is the first post of a series about Algebraic Effects and Handlers.

There are 2 ways to approach this topic:

  • Denotational: explain Algebraic Effects in terms of their meaning in mathematics/Category theory
  • Operational: explain the mechanic of Algebraic Effects by showing how they operate under a chosen runtime environment

Both approaches are valuables and give different insights on the topic. However, not everyone (including me), has the prerequisites to grasp the concepts of Category theory and Abstract Algebra. On the other hand, the operational approach is accessible to a much wider audience of programmers even if it doesn't provide the full picture.

3 Gripes With React

I started using React 3.5 years ago, and I still love it. It was such a well-designed solution that not much has changed since then, only superficial stuff like naming. What I learned then is still wholly applicable today because it's such a good idea (although now you can choose from many other libraries). On top of that, we now benefit from an entirely new architecture (fiber) without changing much.

@developit
developit / *state-machine-component.md
Last active February 6, 2021 00:44
265b lib for building pure functional state machine components. https://github.com/developit/state-machine-component

state-machine-component

A tiny (265 byte) utility to create state machine components using two pure functions.

🔥 JSFiddle Demo

Usage

The API is a single function that accepts 2 pure functions as arguments:

@mehiel
mehiel / crud.js
Created February 10, 2017 09:50
CRUD helpers for redux
import createAction from 'redux-actions/lib/createAction'
import { create, read, update, destroy, params } from 'utils/xhr'
import always from 'ramda/src/always'
import assoc from 'ramda/src/assoc'
import compose from 'ramda/src/compose'
import concat from 'ramda/src/concat'
import dissoc from 'ramda/src/dissoc'
import flip from 'ramda/src/flip'
@kirilloid
kirilloid / type.js
Last active July 29, 2022 19:42
getType
function getType (value) {
let type = typeof value;
if (type === 'object') {
return value ? Object.prototype.toString.call(value).slice(8, -1) : 'null';
}
return type;
}
[NaN, 0, 1, Infinity, // numbers
null, undefined, false, 'str', // other primitives
@jdeng
jdeng / pdf2img.html
Created February 11, 2015 02:54
pdf to image using pdf.js
<html>
<body>
<script type="text/javascript" src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
<script type="text/javascript">
var url = "https://docs.google.com/document/export?format=pdf&id=1ML11ZyyMpnAr6clIAwWrXD53pQgNR-DppMYwt9XvE6s&token=AC4w5Vg7fSWH1Hq0SgNckx4YCvnGPaScyw%3A1423618416864";
var pages = [], heights = [], width = 0, height = 0, currentPage = 1;
var scale = 1.5;
function draw() {
@cheeaun
cheeaun / js-error-logging-services.md
Last active December 10, 2023 13:04
JavaScript error logging services
@casualjim
casualjim / session_token_strategy.scala
Last active December 8, 2017 13:56
Session token strategy example for scalatra auth (scentry)
package org.example
package auth
import org.scalatra.auth.ScentryStrategy
import org.scalatra.{CookieSupport, ScalatraBase}
trait RedisClient {
def get(key: String): Option[String]
}
@JackNorris
JackNorris / rbenv-install-system-wide.sh
Created January 29, 2012 17:36
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core