Skip to content

Instantly share code, notes, and snippets.

View chemzqm's full-sized avatar
🇨🇳
Focusing

Qiming zhao chemzqm

🇨🇳
Focusing
View GitHub Profile
@chemzqm
chemzqm / .pydistutils.cfg
Last active February 19, 2016 17:28
fix pip3 not works on OSX EL Captain
# this would fix the error like: [Errno 1] Operation not permitted: '/bin/vint'
# file should be ~/.pydistutils.cfg
# use homebrew to install python/python3
# see also http://stackoverflow.com/questions/33004708/osx-el-capitan-sudo-pip-install-oserror-errno-1-operation-not-permitted
[install]
prefix=/usr/local
@chemzqm
chemzqm / neorun.vim
Last active February 21, 2016 13:43
" vim:set et sw=2 ts=2 tw=78 nofen:
if exists('did_neorun_loaded') || v:version < 700 || !has('nvim')
finish
endif
let did_neorun_loaded = 1
command! -nargs=? Nrun :call s:TernimalRun(<q-args>)
function! s:TernimalRun(cmd)
execute 'belowright 5new'
if exists('did_completes_me_loaded') || v:version < 700
finish
endif
let did_completes_me_loaded = 1
function! s:completes_me(shift_tab)
let dirs = ["\<c-p>", "\<c-n>"]
if get(b:, 'complete_disable', 0)
return a:shift_tab ? "\<S-Tab>" : "\<Tab>"
endif
@chemzqm
chemzqm / devlorem.vim
Created September 13, 2016 03:51
load lorem from web API
command! -nargs=* Lorem :call s:LoadLorem(<f-args>)
" load lorem with number and optional tag name
function! s:LoadLorem(...)
let num = get(a:, 1, 1)
let html_tag = exists('a:2') ? a:2 : ''
let url = 'https://devlorem.kovah.de/api/'.num.'/json'
let output = system('curl -s '.url)
if v:shell_error && output !=# ""
echohl Error | echon output | echohl None
{
"rules": {
"at-rule-empty-line-before": [ "always", {
"except": [
"blockless-after-same-name-blockless",
"first-nested"
],
"ignore": ["after-comment"]
}],
"at-rule-name-case": "lower",
@chemzqm
chemzqm / css.diff
Created October 12, 2016 06:49
微信小程序 101100 版本样式变更
diff --git a/public/css/default.css b/public/css/default.css
index f5a50e2..f50d447 100644
--- a/public/css/default.css
+++ b/public/css/default.css
@@ -1,19 +1,15 @@
-html,
-body {
+html {
-webkit-user-select: none;
- -moz-user-select: none;
@chemzqm
chemzqm / gist:faa1f6bac2eddc3c15026c1109a8e69f
Last active December 7, 2016 16:06
neovim startup log with python remote plugin
# Command used: nvim --startuptime tmp.txt
# no autocmd and no g:python...
times in msec
clock self+sourced self: sourced script
clock elapsed: other lines
000.009 000.009: --- NVIM STARTING ---
000.592 000.583: locale set
@chemzqm
chemzqm / polyfill.js
Created February 24, 2017 15:31
miniapp polyfill
// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
if (!Object.keys) {
Object.keys = (function() {
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty,
hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'),
dontEnums = [
'toString',
'toLocaleString',
'valueOf',
@chemzqm
chemzqm / promise.js
Created February 24, 2017 15:43
miniapp promise
var PENDING = 'pending'
var SEALED = 'sealed'
var FULFILLED = 'fulfilled'
var REJECTED = 'rejected'
var NOOP = function(){}
function isArray(value) {
return Object.prototype.toString.call(value) === '[object Array]'
}
@chemzqm
chemzqm / git-status.js
Created April 1, 2017 03:10
Gti status by node
#!/usr/bin/env node
var exec = require('child_process').exec
var Branch = new Promise(function(resolve, reject) {
exec('git symbolic-ref -q HEAD | cut -c 12-', function (err, stdout) {
if (err) return reject(err)
if (stdout.length) return resolve(stdout.replace('\n', ''))
exec('git rev-parse --short HEAD', function (err, stdout) {
if (err) return reject(err)