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
" VimScript echom | |
echom abs(-1) | |
function Foo(name) | |
echom a:name | |
endfunction | |
call Foo('Shiqi') |
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
" VimScript callback pattern | |
function Callback(name) | |
echom 'Hello, My name is' | |
echom a:name | |
endfunction | |
function Main(name, callback) | |
call a:callback(a:name) | |
endfunction |
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
// Last updated: Sun Oct 4 04:22:51 CST 2020 | |
const MiniApp = new Promise(resolve => { | |
if (window.MiniApp) { | |
resolve(window.MiniApp); | |
} | |
const id = setInterval(() => { | |
if (MiniApp in window) { | |
clearInterval(id); | |
resolve(window.MiniApp); | |
} |
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 range = (m, n) => Array(n).fill().map((_, i) => i+1).slice(m-1); | |
const expect = (input) => ({ | |
toEqual(expected) { | |
const { stringify } = JSON; | |
if (stringify(expected) !== stringify(input)) { | |
throw Error(`expect ${expected} while ${input}`); | |
} else { | |
console.info('Pass'); |
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
set encoding=UTF-8 | |
set clipboard+=unnamed | |
set relativenumber | |
filetype plugin indent on | |
filetype plugin on | |
call plug#begin('~/.vim/plugged') | |
Plug 'moll/vim-bbye' | |
Plug 'aymericbeaumet/vim-symlink' |
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
import { serve } from 'https://deno.land/std/http/server.ts'; | |
const server = serve({ port: 1234 }); | |
for await (const req of server) { | |
const body = new TextDecoder() | |
.decode(await Deno.readAll(req.body)); | |
console.log(JSON.parse(body); | |
} |
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 http = require('http'); | |
http.createServer((req, res) => { | |
cosnt data = []; | |
req.on('data', chunk => data.push(chunk)); | |
req.on('end', () => { | |
try { | |
console.log(JSON.parse(data)); | |
catch(err) { |
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 http = require('http'); | |
http.createServer((req, res) => { | |
cosnt data = []; | |
req.on('data', chunk => data.push(chunk)); | |
req.on('end', () => { | |
try { | |
console.log(JSON.parse(data)); | |
catch(err) { |
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
source /etc/bash_completion | |
shopt -s histappend | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
shopt -s checkwinsize | |
case "$TERM" in | |
xterm-color|*-256color) color_prompt=yes;; | |
esac |
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
user www-data; | |
worker_processes auto; | |
pid /run/nginx.pid; | |
## based on https://gist.github.com/cboettig/8643341bd3c93b62b5c2 | |
events { | |
worker_connections 1024; | |
} |
NewerOlder