Skip to content

Instantly share code, notes, and snippets.

View zhang-ning's full-sized avatar

zhang-ning zhang-ning

View GitHub Profile
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.'))
@zhang-ning
zhang-ning / hello.html
Created January 30, 2014 11:37
a example for testing gist
<p> hello world.</p>
#fix github cdn problem because of GFW
185.31.17.184 github.global.ssl.fastly.net
@zhang-ning
zhang-ning / ng-enter
Created September 29, 2014 07:25
angular
/*
This directive allows us to pass a function in on an enter key to do what we want.
*/
app.directive('ngEnter', function () {
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if(event.which === 13) {
scope.$apply(function (){
scope.$eval(attrs.ngEnter);
});
'use strict';
// generated on 2014-10-06 using generator-gulp-webapp 0.1.0
var gulp = require('gulp');
// load plugins
var $ = require('gulp-load-plugins')();
gulp.task('styles', function () {
return gulp.src('app/styles/main.scss')
var spawn = require('child_process').spawn;
var fs = require('fs');
var path = require('path');
var os = require('os');
var request = require('request');
function waitForJavaScript() {
if(window.MathJax) {
// Amazon EC2: fix TeX font detection
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Startup",function () {
/*
* all rights resorved by [email protected] @猎人豆豆 @hunter.dding
* please notice that the define,main are occupied as gloable variable
* but most of time you only need to use define with CMD stand.
* river.js by Jonathan version 13.11
*/
var _$river = {
// module define and run api
sandbox: function() {
var boxes = {};
'use strict';
angular.module('agroupApp')
.controller('FileCtrl', ['$scope', 'fileIcon', 'Modal', 'messageAPI', 'folderAPI',
function($scope, fileIcon, Modal, messageAPI, folderAPI) {
$scope.$on('groupChanged',function(event,group) {
list(group)
});
@zhang-ning
zhang-ning / 如何创建伟大社区
Created March 18, 2015 19:51
Brick By Brick: A free guide to building awesome communities
http://www.communitybuildingguide.com/
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew