Skip to content

Instantly share code, notes, and snippets.

View MattSPalmer's full-sized avatar

Matt Palmer MattSPalmer

View GitHub Profile
{
"folke/flash.nvim",
event = "VeryLazy",
---@type Flash.Config
opts = {},
keys = {
{
"s",
mode = { "n", "x", "o" },
function()
function nvim_packer_restart() {
nvim "$@"
if [[ -e "$TMPDIR""packer_compile_at_start" ]]; then
nvim_packer_restart "$0"
fi
}
alias nvim='nvim_packer_restart'
@MattSPalmer
MattSPalmer / on-subscribe.js
Last active May 11, 2020 04:43
debug subscriptions
const onSubscribe = (fn) => stream => Rx.defer(() => {
fn();
return stream;
})
const logOnSubscribe = message => onSubscribe(() => console.log(message));
Rx.interval(10e3).pipe(
switchMap(() => interval(200).pipe(
logOnSubscribe('subscribed to 200ms interval')
import _ from 'underscore';
import { useState, useEffect } from 'react';
import { isObservable } from 'rxjs';
const useObservable = (observable, initial) => {
const [next, setNext] = useState(initial);
const [isComplete, setIsComplete] = useState(false);
const [error, setError] = useState();
useEffect(
@MattSPalmer
MattSPalmer / show-me.js
Last active October 23, 2018 15:41
Module providing a utility to update an object on `window` for observation via Chrome Live Expressions
// Use in tandem with Chrome Live Expressions to track values you're interested in.
// https://developers.google.com/web/updates/2018/08/devtools#watch)
window.showMe =
window.showMe ||
(() => {
return window.watchMe || null;
});
export const showMe = (key, value) => {