Skip to content

Instantly share code, notes, and snippets.

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
lionel-rowe / insaneOptions.js
Last active March 23, 2023 12:45
insane options for use with marked and highlightjs
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']
},
/*
source: https://github.com/zeit/now-examples/blob/3f609858904e7dafbd016a255de325a936cf240f/nextjs-news/lib/get-stories.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
lionel-rowe / linux-terminal.md
Last active October 17, 2018 10:11
Useful terminal commands/shortcuts (Linux::Ubuntu)

Useful terminal commands and shortcuts (Linux::Ubuntu)

Commands

  • 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
@lionel-rowe
lionel-rowe / cs_it_cloud_learning_resources.md
Last active October 30, 2018 00:09
Learning Resources (CS/Cloud/Tech Writing)