Skip to content

Instantly share code, notes, and snippets.

@hulufei
hulufei / vim-sexp-cheatsheet.md
Last active November 13, 2023 07:16 — forked from cszentkiralyi/vim-sexp-cheatsheet.md
vim-sexp cheatsheet

Prereqs

These are for the combined vim-sexp (https://github.com/guns/vim-sexp) and vim-sexp-mappings-for-regular-people (https://github.com/tpope/vim-sexp-mappings-for-regular-people) plugins. vim-sexp is neat on its own but Tim Pope makes common stuff much easier.

Note that some vim-sexp functionality depends on <LocalLeader> mappings. This is a different leader key than the global leader, and is the variable maplocalleader (instead of mapleader). To see if you have this set, use :echo maplocalleader; if it errors out you'll need to set it, otherwise it will echo the key. If you want to set your LocalLeader to <Space>, you'll need two commands in your .vimrc, since by default <Space> is bound to <Right> in normal mode:

nnoremap <Space> <Nop>
let maplocalleader=" "

TOC

@hulufei
hulufei / http-proxy-cookies.js
Last active October 10, 2018 09:50
http-proxy with cookies and gzip responses(Solved CORS limit)
var http = require("http"),
httpProxy = require("http-proxy");
var url = require("url");
var zlib = require("zlib");
var proxy = httpProxy.createProxyServer({});
proxy.on("proxyRes", function(proxyRes, req, res) {
console.log("Proxy response");
// res.headers = proxyRes.headers;
type tree =
| Leaf(string)
| Node(Js.Dict.t(tree));
type dictTree = Js.Dict.t(tree);
type translations =
| Translations(Js.Dict.t(string));
let rec treeDecoder = json =>
@hulufei
hulufei / toggl_import.py
Created July 30, 2018 01:37 — forked from khaeru/toggl_import.py
Toggl → Timewarrior import extension
#!/usr/bin/env python3
"""Toggl → Timewarrior import extension
© 2016 Paul Natsuo Kishimoto <[email protected]>
Licensed under the GNU GPL v3 or later.
Implements a Timewarrior extension (see
https://taskwarrior.org/docs/timewarrior/index.html) to import data from Toggl
(http://toggl.com).
@hulufei
hulufei / Antd_Steps.re
Last active July 22, 2018 05:41
Bs bind for JS object, specially for callback object arguments.
/* Bind for https://ant.design/components/steps/ */
[%bs.raw {|require("antd/lib/steps/style")|}];
type dotOptions = {
.
"index": int,
"status": string,
"title": string,
"description": string,
@hulufei
hulufei / webpack.boilerplate.js
Last active December 28, 2015 02:36
webpack style/font/img loaders
npm i --save-dev webpack webpack-dev-server url-loader file-loader style-loader css-loader autoprefixer-loader img-loader --save-dev
@hulufei
hulufei / Multi-Line Ellipsis.html
Last active August 29, 2015 14:04
Multi-Line Ellipsis
<div class="ellipsis">
<div>
<p>
content text here
<i></i>
</p>
</div>
<a id="readmore" href="#">Read More</a>
</div>
@hulufei
hulufei / blur-click-event-order
Last active August 29, 2015 14:03
Blur event hidden click trigger
`click` event triggers after the `blur` so the link gets hidden. Instead of click use `mousedown` it will work.
@hulufei
hulufei / fixed position relative to parent.md
Last active June 26, 2018 05:37
Fixed element relative to it's parent

第一种方法

<div class="container">
  <div class="fixed">content</div>
</div>
.fixed {
@hulufei
hulufei / collapse-as-table.css
Last active December 29, 2015 17:19
Collapse border like table cell.
ul {
// align
margin-left: 1px;
}
li {
float: left;
border: 1px solid #ccc;
// container bg
background: #FFF;