Skip to content

Instantly share code, notes, and snippets.

@connorjclark
connorjclark / memory-test.ts
Created May 27, 2020 18:48
memory leak test
import { ChildProcess, spawn } from 'child_process';
import * as puppeteer from 'puppeteer';
const DEBUG = Boolean(process.env.DEBUG);
const CI = Boolean(process.env.CI);
const QUERY = Boolean(process.env.QUERY);
jest.setTimeout((QUERY ? 200 : 100) * 1000);
interface MemorySample {
@jfcherng
jfcherng / st4-changelog.md
Last active February 10, 2024 20:21
Sublime Text 4 changelog just because it's not on the official website yet.
@loilo
loilo / idb-backup-and-restore.md
Last active March 22, 2024 16:42
Back up and restore an IndexedDB database

Back up and restore an IndexedDB database

This gist is an ES module which provides functions to import and export data from an IndexedDB database as JSON. It's based on Justin Emery's indexeddb-export-import package, but applies some adjustments that reflect better on the current browser landscape (i.e. better developer ergonomics but no support for Internet Explorer).

Usage

For each of the provided functionalities, you need a connected IDBDatabase instance.

Export Data

import { idb } from 'some-database'
@loilo
loilo / pass-slots.md
Last active March 27, 2024 20:58
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@mes01
mes01 / LC_CTYPE.txt
Created October 31, 2017 16:27 — forked from thanksdanny/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@math2001
math2001 / Revert sublime text 3 to a fresh state.md
Last active March 21, 2024 13:34
Revert Sublime Text 3 to a fresh state step by step 🙂

[UPDATE] Sublime Text 4

If you have the latest sublime text (version 4), you can just do:

subl --safe-mode

How do I revert Sublime Text 3 to a fresh state

@subfuzion
subfuzion / curl.md
Last active March 27, 2024 16:11
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ecarter
ecarter / mapOrder.js
Created December 2, 2011 15:40
Order an array of objects based on another array order
/**
* Sort array of objects based on another array
*/
function mapOrder (array, order, key) {
array.sort( function (a, b) {
var A = a[key], B = b[key];