Skip to content

Instantly share code, notes, and snippets.

View outlook-mixed-encoding-subject-bug.eml
Date: Thu, 01 Jan 1970 00:00:00 +0000 (UTC)
From: ABC <>
To: XYZ <>
MIME-Version: 1.0
Content-Type: text/plain;
View 姓名_parser.js
const 姓名 = [...document.querySelectorAll('li p')]
.map(x => x.textContent.trim().match(/^\d+\.(.+)$/))
.map(x => x[1])
const = [ Set(姓名.map(x => x[0]))].join('')
const = [ Set(姓名.flatMap(x => [...x.slice(1)]))].join('')
View highlightify.js
// ==UserScript==
// @name Highlightify
// @namespace
// @version 0.4
// @description Highlightify Stack Exchange
// @author @lionel-rowe
// @match*
// @grant none
// ==/UserScript==
/* global StackExchange */
lionel-rowe /
Last active Jun 17, 2019 — forked from bartoszmajsak/
How to automatically prepend git commit with a branch name
# This way you can customize which branches should be skipped when
# prepending commit message.
# curl <link_to_raw> > .git/hooks/prepare-commit-msg && chmod u+x .git/hooks/prepare-commit-msg
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
lionel-rowe / QueryParams.js
Last active Apr 30, 2019
QueryParams - super-simple query string parser with comma-delimited arrays
View QueryParams.js
const QueryParams = {};
QueryParams.options = {
usePlusSigns: false, // per RFC 1866 application/x-www-form-urlencoded; otherwise use "%20" for space
keyMustReturnArray: key => key.endsWith('_arr') // for URI-decoded keys that return `true` for this function, coerce the value to an array even if it contains no commas
const decode = str => {
if (QueryParams.options.usePlusSigns) {
str = str.replace(/\+/g, '%20');
View spamfilter_v2.js
Concepts covered:
concept | syntax
testing for a match | test
replacing matches | replace
...with a string | replace(re, '...')
...with a function | replace(re, m => ...)
View spamfilter.js
const alphabetMap = {
a: 'a@4', b: 'b8', c: 'c{\\[(', d: 'd', e: 'e3', f: 'f', g: 'g69', h: 'h',
i: 'i|', j: 'j', k: 'k', l: 'l', m: 'm', n: 'n', o: 'o0', p: 'p', q: 'q',
r: 'r', s: 's5', t: 't7', u: 'u', v: 'v', w: 'w', x: 'x', y: 'y', z: 'z2'
const makeRegex = str => {
const inner = str.split('').map(char => {
const chars = alphabetMap[char];
lionel-rowe / insaneOptions.js
Last active Mar 3, 2019
insane options for use with marked and highlightjs
View insaneOptions.js
const insaneOptions = {
allowedAttributes: {
a: ['href', 'name', 'target', 'rel', 'title'],
img: ['src', 'alt', 'title'],
input: ['type', 'checked', 'disabled'],
code: ['class'],
span: ['class'],
th: ['align'],
tr: ['align']
View get-stories-commented.js
The actual functionality isn't anything special - it just gets data about news
stories for a typical hacker-news-clone demo app.
What I like is how this really short snippet shows off so many really nice
features of modern JavaScript. This is the snippet I'd show to rebut someone
claiming "JavaScript is a poorly-designed language created by Brendan Eich in
10 days".
lionel-rowe /
Last active Oct 17, 2018
Useful terminal commands/shortcuts (Linux::Ubuntu)

Useful terminal commands and shortcuts (Linux::Ubuntu)


  • sudo apt-get install <pkg name> install package
  • sudo apt-get remove <pkg name> remove package
  • apt list | grep <txt to search> search currently installed packages
  • xkill kill an unresponsive window w. mouse
  • touch to create file, mkdir to create dir
  • rm to delete file, rmdir to delete dir