Skip to content

Instantly share code, notes, and snippets.

View shiqimei's full-sized avatar
🎯
Focusing

Shiqi Mei shiqimei

🎯
Focusing
View GitHub Profile
" VimScript echom
echom abs(-1)
function Foo(name)
echom a:name
endfunction
call Foo('Shiqi')
" 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
// 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);
}
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');
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'
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);
}
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) {
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) {
source /etc/bash_completion
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
@shiqimei
shiqimei / nginx.conf
Created November 26, 2019 06:53 — forked from kylemcdonald/nginx.conf
nginx config for port forwarding to a Jupyter instance on localhost.
user www-data;
worker_processes auto;
pid /run/nginx.pid;
## based on https://gist.github.com/cboettig/8643341bd3c93b62b5c2
events {
worker_connections 1024;
}