Skip to content

Instantly share code, notes, and snippets.

@mcfog
mcfog / Ability Model.xmind
Last active March 26, 2023 14:55
软件技术人员能力模型
#!/usr/bin/env awk -f
/success/ { print "\033[92m" $0 "\033[0m"; next; }
/error/ { print "\033[91m" $0 "\033[0m"; next; }
/./ { print $0 }
@mcfog
mcfog / gitabbr.fish
Last active November 29, 2019 07:43
abbr g git
abbr ga 'git add'
abbr gaa 'git add --all'
abbr gb 'git branch'
abbr gbda git\ branch\ --merged\ \|\ command\ grep\ -vE\ \"\^\(\\\*\|\\s\*master\\s\*\\\$\)\"\ \|\ command\ xargs\ -n\ 1\ git\ branch\ -d
abbr gbnm 'git branch --no-merged'
abbr gbr 'git branch --remote'
abbr gc 'git commit -v'
abbr gc! 'git commit -v --amend'
abbr gca 'git commit -v -a'
https://press.one/p/address/v?s=0d80826215b9101cfb46e551202cb9db44c6ae6c608020ad301cd46d3f8eb0dde15718edd6f46e768dec4617dad23bc203f0d791a3369e08fa6b4fc0ef2244371&h=973c23a77c5d9bf694f718f3afd579fa5e97a411cd71e4d6dadf8299133a7b6f&a=ee8917ea16dc93624aa7d604e7a328db246c787d&f=P1&v=2
@mcfog
mcfog / paging.js
Created March 13, 2017 05:30
answer for promise paging exercise
//ref https://www.v2ex.com/t/346533#r_4122841
const api = (num) => {
const allNum = 3 + parseInt(7 * Math.random());//你不知到总页数的
const quality = 0.15;//接口质量指数
return new Promise((resolve, reject) => {
setTimeout(_=>{//超时逻辑
reject({
code: 'CODE_TIMEOUT',
msg: 'timeout'
<?php
class Paginator implements \IteratorAggregate
{
const TPL_WRAPPER = 'wrapper';
const TPL_NUM = 'num';
const TPL_NUM_CURRENT = 'currentNum';
const TPL_TAG = 'tag';
const TPL_NEXT = 'next';
const TPL_PREV = 'prev';
<- define <[jquery]>
let @ = Deferred = {}
@when = $~when
@defer = ->
dfr = $.Deferred!
{
@mcfog
mcfog / grid.styl
Created June 13, 2013 21:49
a semantic grid mixin for Stylus, better with PR <https://github.com/LearnBoost/stylus/pull/1048>
grid-ctn(containerwidth, col, padwidth = grid-devide(containerwidth, col * 8))
$grid_width grid-devide(containerwidth, col)
$grid_col col
$grid_padding grid-devide(padwidth, 2)
width containerwidth
position relative
clearfix()
grid-block(colspan)
@mcfog
mcfog / README.md
Created June 12, 2013 13:25
`hexo new` 后自动打开新建的文件

用法:将open.js放入scripts目录下,然后在你的hexo目录中打开cmd,执行

npm i open

即可

@mcfog
mcfog / preview.co
Last active December 17, 2015 18:39
hexo-preview
(args) <- hexo.extend.console.register 'preview' 'watch change and run server'
hexo.extend.console.list!generate {w:true}
hexo.extend.console.list!server args