Skip to content

Instantly share code, notes, and snippets.

View jrolfs's full-sized avatar

Jamie Rolfs jrolfs

View GitHub Profile
@junosuarez
junosuarez / gitstatus-prompt.zsh
Created October 28, 2022 07:46
starship + gitstatusd
#!/bin/zsh
# include this file in your shell config
autoload -Uz add-zsh-hook
# this file comes from installing https://github.com/romkatv/gitstatus
SOURCE "${HOMEBREW_PREFIX:-/usr/local}/opt/gitstatus/gitstatus.plugin.zsh" || return
gitstatusd_instance='GSD'
# the following are a mystery - why do they define the fn names with $1?
import { useEffect, useLayoutEffect } from 'react';
// eslint-disable-next-line max-len
// See https://github.com/reduxjs/react-redux/blob/316467a/src/hooks/useSelector.js#L6-L15
export const useIsomorphicLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
export const useServerNoopLayoutEffect =
typeof window !== 'undefined' ? useLayoutEffect : () => ({});
@tamakiii
tamakiii / .zshrc
Last active August 19, 2018 13:23
Fix "(eval):setopt:3: no such option: NO_warnnestedvar" with Zsh
We couldn’t find that file to show.
@svenk
svenk / ViewSourceWith.ps1
Created November 17, 2017 11:59
A Firefox Quantum ViewSourceWith extension workaround with Firefox's source.editor.external
# A Firefox Quantum ViewSourceWith replacement for Windows
#
# Usage:
# (1) Save as C:\path\to\script.ps1
# (2) In order to run your own powershell scripts, start PowerShell
# as Administrator and run the command
#
# Set-ExecutionPolicy RemoteSigned
#
# (2) You can test the proper running (from a user cmd):
@jrolfs
jrolfs / Makefile
Last active August 27, 2021 18:30
Machine bootstrap
home := $${HOME}
shell := /bin/bash
nix := /nix/var/nix
nix_darwin := /run
brew := /opt/homebrew
key := id_ed25519
public_key := .ssh/$(key).pub
github_key := .ssh/github.txt
@VictorTaelin
VictorTaelin / promise_monad.md
Last active March 23, 2024 17:49
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@aferriss
aferriss / levels.glsl
Created April 26, 2017 23:20
GLSL Photoshop Style Levels Adjustment
vec3 gammaCorrect(vec3 color, float gamma){
return pow(color, vec3(1.0/gamma));
}
vec3 levelRange(vec3 color, float minInput, float maxInput){
return min(max(color - vec3(minInput), vec3(0.0)) / (vec3(maxInput) - vec3(minInput)), vec3(1.0));
}
vec3 finalLevels(vec3 color, float minInput, float gamma, float maxInput){
return gammaCorrect(levelRange(color, minInput, maxInput), gamma);
@torgeir
torgeir / build.boot
Last active May 12, 2017 15:16
Figwheel boot clj setup, live reloading cljs and css
(set-env! :dependencies '[
[org.clojure/clojure "1.8.0" :scope "provided"]
[org.clojure/clojurescript "1.9.89" :scope "provided"]
[ajchemist/boot-figwheel "0.5.4-5"] ;; latest release
[org.clojure/tools.nrepl "0.2.12" :scope "test"]
[com.cemerick/piggieback "0.2.1" :scope "test"]
[figwheel-sidecar "0.5.4-5" :scope "test"]
[pandeiro/boot-http "0.7.2" :scope "test"]])
@fats
fats / weechat_theme.txt
Last active October 27, 2023 18:22
[weechat] The Theme™
# requires: 256 color terminal
/script install iset.pl
/script install buffers.pl
/script install colorize_nicks.py
/set weechat.look.buffer_notify_default message
/set weechat.look.color_nick_offline on
/set weechat.look.prefix_action " •"
/set weechat.look.prefix_join "▬▶"
@jfmengels
jfmengels / lodash-fp-documentation.md
Last active February 6, 2024 20:57
Generated docs for Lodash/fp. Help make them better at https://github.com/jfmengels/lodash-fp-docs