Skip to content

Instantly share code, notes, and snippets.

View axyz's full-sized avatar

Andrea Moretti axyz

  • Zalando SE
  • Berlin
View GitHub Profile
let barposition = "bottom"
let mapleader = ","
map b :buffer<Space>
map B :bookmarks<Space>
map <C-u> scrollPageUp
map <C-d> scrollPageDown

What to use

  • Test runner: ava
  • React components testing: enzyme
  • Endpoint testing: express + supertest
  • Mocking framework: sinon
  • External dependencies mocking: proxyquire

Test cases

all the following examples are using ava syntax, but they may be easily adapted to mocha or tape as well

@axyz
axyz / code-url-encoder.ts
Created September 14, 2023 07:46
Encode code string in a compressed URL string
import { strToU8, strFromU8, compressSync, decompressSync } from "fflate";
const urlEncode = (str: string) =>
btoa(str).replace(
/[/+=]/g,
(a) => ({ "/": "-", "+": "_", "=": "~" }[a] || a)
);
const urlDecode = (str: string) =>
atob(str.replace(/[-_~]/g, (a) => ({ "-": "/", _: "+", "~": "=" }[a] || a)));
@axyz
axyz / early-init.el
Last active July 8, 2025 11:39
.emacs.d
;;; early-init.el --- Early Init -*- no-byte-compile: t; lexical-binding: t; -*-
;;; variables
(defvar enable-debug-p nil
"non-nil to enable debug.")
;;; garbage collection
;; garbage collection significantly affects startup times. this setting delays
;; garbage collection during startup but will be reset later.