Skip to content

Instantly share code, notes, and snippets.

@mondaychen
mondaychen / 2023年终总结.md
Last active December 31, 2023 00:20
2023年终总结


2023:不可思议的幸运之年

写在最前面

我一直很佩服能坚持写作的人。我自己写东西的时候八成都是这样的三部曲:产生强烈的表达冲动——越写越觉得自己的想法和表达有缺失——把半成品忘在草稿箱里。
今年我下决心无论如何都要把年终总结写出来,因为在生活的方方面面都发生了太多重要的事了。但是写着写着又开始自我怀疑:说了这么多事,好像每个都有点感悟,又每个都没写清楚,这算个什么哪门子的文章?正这么想的时候在推特上看到了 Rick Rubin 的一个视频叫作《How to deal with a creative block》。他鼓励内容创作者写东西就当作写日记,只为自己一个人写,认真写,不用为别人负责。
谢谢 Rubin,谢谢宇宙。这篇总结我就为了自己写。

@wintercn
wintercn / lightpromise.js
Last active January 4, 2022 01:45
一组小清新的promise风格小函数
function get(uri) {
return http(uri,'GET');
}
function post(uri,data) {
if(typeof data === 'object' && !(data instanceof String || (FormData && data instanceof FormData))) {
var params = [];
for(var p in data) {
if(data[p] instanceof Array) {
for(var i = 0; i < data[p].length; i++) {
params.push( encodeURIComponenet(p) + '[]=' + encodeURIComponenet(data[p][i]);
@jcouyang
jcouyang / why-curry-helps.md
Last active February 20, 2023 21:09
为什么要柯里化(why-curry-helps)slide http://git.io/why-curry-helps 📈

还记得 Haskell Curry吗,

多巧啊, 人家姓 Curry 名 Haskell, 难怪 Haskell 语言会自动柯里化, 呵呵. 但是不奇怪吗, 为什么要柯里化呢. 为什么如此重要导致 Haskell 会默认自动柯里化所有函数, 不就是返回一个部分配置好的函数吗.

我们来看一个 Haskell 的代码.

max 3 4
(max 3) 4
@branneman
branneman / better-nodejs-require-paths.md
Last active June 27, 2024 10:40
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@ngryman
ngryman / README.md
Last active January 16, 2023 14:07
intellij javascript live templates

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
@leiming
leiming / gist:3762717
Created September 21, 2012 17:15
vimrc
set nocompatible " 非兼容模式
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle "MarcWeber/vim-addon-mw-utils"
Bundle "tomtom/tlib_vim"
Bundle "honza/snipmate-snippets"
Bundle "garbas/vim-snipmate"
@scrooloose
scrooloose / hax0r.vim
Created January 10, 2012 10:03 — forked from asgeo1/hax0r.vim
NERDTree custom mappings to make i and s reuse existing windows
let g:NERDTreeCustomReuseWindows = '1'
call NERDTreeAddKeyMap({
\ 'key': 'w',
\ 'scope': 'all',
\ 'callback': 'NERDTreeCustomToggleReuse',
\ 'quickhelpText': 'Toggle use existing windows' })
function! NERDTreeCustomToggleReuse()
let g:NERDTreeCustomReuseWindows = g:NERDTreeCustomReuseWindows ? 0 : 1