Skip to content

Instantly share code, notes, and snippets.

@jefftangx
jefftangx / jq
Created August 14, 2019 21:36
recipes
# print names of all branches
cat ./data/all_branches.json \
| jq 'map(.name)' \
> ./data/all_branches.txt
# filter to only include branches that start with "RS"
cat ./data/all_branches.json \
| jq 'map(select(.name | test("^RS")) | .name)' \
> ./data/rs_branches.txt
{
"blockedSites": [],
"charsToAutoInsertUserList": [
[
"(",
")"
],
[
"{",
"}"
const assert = require('assert')
/* takes in two strings, and returns if they are anagrams */
function isAnagram(a,b) {
if (a.length != b.length) {
return false
}
var o1 = {}
var o2 = {}
@jefftangx
jefftangx / pyramid.js
Created September 2, 2018 13:58
fn that takes in a number n, and prints a right aligned pyramid such that line 1 has n-1 spaces and 1 hash, line 2 has n-2 spaces and 2 hashes...
// n = 6
// 5 ' ' 1 '#' = 6
// 4 ' ' 2 '#' = 6
// 3 ' ' 3 '#' = 6
// 2 ' ' 4 '#' = 6
// <= inclusive
// < exclusive
/*
* worst case, Big O of O(n*n)
@jefftangx
jefftangx / cVim
Last active April 17, 2021 23:27
cVim config
let completionengines = ["duckduckgo", "google-maps", "youtube", "wikipedia"]
let defaultengine = "duckduckgo"
let searchalias y = "youtube"
let searchalias m = "google-maps"
let searchalias w = "wikipedia"
let blacklists = ["https://trello.com/*","https://www.youtube.com/*","https://mail.google.com/*","https://soundcloud.com/*","https://www.reddit.com/*","https://hackrice.typeform.com/*","https://repl.it/*","https://calendar.google.com/*","https://codepen.io/*","https://cckl.github.io/*","http://localhost/*","http://keycode.info/*","https://www.figma.com/*","https://photos.google.com/*","http://jefftang.world/*","https://dashboard.lytmus.io/*","https://app.codesignal.com/*","https://docs.google.com/*","https://web.telegram.org/*","https://coderpad.io/*","http://webchat.freenode.net/*","http://ternjs.net/*","https://github.com/*projects/*"]
map zx zi
map zc zo