Skip to content

Instantly share code, notes, and snippets.

import invariant from "tiny-invariant";
class AmalgoBox extends HTMLElement {
get input() {
return this.querySelector("input") as HTMLInputElement;
}
get button() {
return this.querySelector("button") as HTMLButtonElement;
}
@frabert
frabert / COPYING
Last active December 21, 2023 13:35
Favicons for HN
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@mzeryck
mzeryck / mz_calendar_widget.js
Last active August 29, 2021 14:40
A Scriptable widget that shows upcoming calendar events to mimic the built-in Calendar widget, with some modifications.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: red; icon-glyph: calendar-alt;
// This widget was created by Max Zeryck @mzeryck
// Note: before using this script in a widget, change const TEST_MODE to true and run it in the Scriptable app.
// The app will prompt you to give calendar access, and then show a preview of the widget.
// Make sure to change it back to const TEST_MODE = false prior to adding it to a widget. Happy coding!
@sebmarkbage
sebmarkbage / The Rules.md
Last active April 22, 2024 04:41
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@yinchuan
yinchuan / download_voa.py
Last active April 14, 2022 07:27
下载VOA慢速英语的脚本,下载内容保存在D:\VOA目录下。
# -*- coding: utf8 -*-
# 下载速度很慢,
import urllib2, urllib
import sys
import os
import socket
import re
import socks
@Viper007Bond
Viper007Bond / gist:2314628
Created April 5, 2012 22:18
WordPress: Get all posts but only so many at a time
<?php
$query_args = array(
'foo' => 'bar',
'apple' => 'orange',
'posts_per_page' => 50,
'offset' => 0,
);

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: