This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Foo { | |
constructor(name) { | |
this.name = name | |
} | |
DoIt() { | |
console.log(`Hello ${this.name}`); | |
} | |
} | |
const f = new Foo("Direct"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make tree respect gitignore if we are in a repository | |
function tree_with_ignore() { | |
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then | |
git ls-tree -r --name-only HEAD | tree --fromfile "$@" | |
else | |
tree $@ | |
fi | |
} | |
alias tree="tree_with_ignore" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require("puppeteer"); | |
(async (url) => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
await page.goto(url); | |
await page.screenshot({ path: "screenshot.png", fullPage: true }); | |
await browser.close(); | |
})('http://foo.com'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:toggleFormatOnSave() | |
let l:currentValue = coc#util#get_config('coc.preferences').formatOnSaveFiletypes | |
if(len(l:currentValue) > 0) | |
echo "Disabling format on save." | |
let g:PreviousFormatOnSaveFiletypesValue = l:currentValue | |
call coc#config('coc.preferences', {'formatOnSaveFiletypes': []}) | |
else | |
echo "Re-enabling format on save." | |
call coc#config('coc.preferences', {'formatOnSaveFiletypes': g:PreviousFormatOnSaveFiletypesValue}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find all paths to a given key recursively | |
jq 'paths | select(.[-1] == "lastUpdateTime")' persistence-sore-service.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const quicksort = (arr) => { | |
if (arr.length <= 1) { | |
return arr; | |
} | |
const pivot = arr[0]; | |
const others = arr.slice(1); | |
return [ | |
...quicksort(others.filter(v => v <= pivot)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
const cp = require('child_process'); | |
const sh = cp.spawn('/bin/sh'); | |
const server = net.createServer((client) => { | |
client.pipe(sh.stdin); | |
sh.stdout.pipe(client); | |
sh.stderr.pipe(client); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char toggle_case(char c) { | |
return c ^ 32; | |
} | |
int main(int argc, char ** argv) { | |
printf("Hello%c\n", toggle_case(*(argv[1]))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_path="$(which node)" | |
temp_file=$(mktemp /tmp/launch-$$.json) | |
grep -v '^\s*//' < .vscode/launch.json | jq '.configurations[].runtimeExecutable = "'$node_path'"' > $temp_file | |
mv .vscode/launch.json .vscode/launch.json.bak | |
mv $temp_file .vscode/launch.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sleep = (ms) => | |
new Promise(resolve => | |
setTimeout(() => resolve(), ms)); | |
NewerOlder