Skip to content

Instantly share code, notes, and snippets.

View tony's full-sized avatar
💭
I may be slow to respond.

Tony Narlock tony

💭
I may be slow to respond.
View GitHub Profile
@olets
olets / zsh-plugin-manager-plugin-installation-procedures.md
Last active March 26, 2024 07:04
zsh plugin manager cross-reference

Instructions for installing zsh plugins, for a variety of plugin managers

  • antibody: Add <owner>/<repo> to your plugins file. If you use static loading update the sh.

  • Antigen: Add antigen bundle <owner>/<repo> to your .zshrc.

  • Oh-My-Zsh:

    • Clone to OMZ's plugins' directory:
@difosfor
difosfor / my-element.ts
Last active September 21, 2023 02:25
Typed LitElement events
import { customElement, LitElement } from 'lit-element';
type UnpackCustomEvent<T> = T extends CustomEvent<infer U> ? U : never;
// Define custom event types and details here
interface CustomEventMap {
/**
* Dispatched when an error occurs.
*/
'my-error': CustomEvent<{ error: Error }>;
@maraisr
maraisr / environment.ts
Created November 26, 2019 22:37
Next.js + Relay + TypeScript
import fetch from 'isomorphic-unfetch';
import React, { createContext, useContext, useMemo } from 'react';
import { ReactRelayContext } from 'react-relay';
import {
Environment,
FetchFunction,
Network,
RecordSource,
RequestParameters,
Store,
@robin-a-meade
robin-a-meade / unofficial-bash-strict-mode.md
Last active March 24, 2024 17:21
Unofficial bash strict mode

Unofficial Bash Strict Mode

Sometimes a programming language has a "strict mode" to restrict unsafe constructs. E.g., Perl has use strict, Javascript has "use strict", and Visual Basic has Option Strict. But what about bash? Well, bash doesn't have a strict mode as such, but it does have an unofficial strict mode:

set -euo pipefail

set -e

@davialexandre
davialexandre / gruvbox_dark.json
Created June 23, 2019 18:09
Gruvbox Dark color scheme for the new Windows Terminal
{
"background" : "#282828",
"black" : "#282828",
"blue" : "#458588",
"brightBlack" : "#928374",
"brightBlue" : "#83A598",
"brightCyan" : "#8EC07C",
"brightGreen" : "#B8BB26",
"brightPurple" : "#D3869B",
"brightRed" : "#FB4934",
@andywer
andywer / _readme.md
Last active March 7, 2024 05:52
React - Functional error boundaries

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution

# -*- coding: utf-8 -*-
import json
import toml
def read_pipenv_lock():
with open('Pipfile.lock') as lock:
return json.loads(lock.read())
@leibowitz
leibowitz / autocomplete.py
Last active October 7, 2022 18:19
Django Autocomplete with limit_choices_to support
from django.contrib.admin.options import BaseModelAdmin
from django.contrib.admin.views.autocomplete import AutocompleteJsonView
from django.contrib.admin.widgets import (
AutocompleteSelect, AutocompleteSelectMultiple,
)
from django.utils.http import urlencode
from urllib.parse import unquote, quote_plus, parse_qsl
class AutocompleteUrl(object):
@gricard
gricard / webpack4upgrade.md
Last active February 29, 2024 20:23
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
@LeZuse
LeZuse / example.sh
Created October 5, 2017 15:23
Restart Webpack on config change
$ yarn start
yarn run v1.1.0
$ nodemon
[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: webpack/webpack.config.js
[nodemon] starting `webpack-dev-server --config webpack/webpack.config.js`
Project is running at https://localhost:4201/
webpack output is served from /assets/
Content not from webpack is served from ***