From 04ab1dabbfc407fce3243c286c8103a1f35030ce Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Sat, 30 May 2015 02:11:28 +0800 Subject: [PATCH] Update --- sass.md | 33 +++++++++++++++++++ vimscript-snippets.md | 74 ++++++++++++++++++++++++++++++++++++++++--- yargs.md | 6 ++-- 3 files changed, 106 insertions(+), 7 deletions(-) diff --git a/sass.md b/sass.md index ee12a7f3e..09d901fd1 100644 --- a/sass.md +++ b/sass.md @@ -3,6 +3,39 @@ title: Sass layout: default --- +### Color functions + + rgb(r,g,b) + rgba(r,g,b,a) + rgba($color, a) + + darken($color, 5%) + lighten($color, 5%) + saturate($color, 5%) + desaturate($color, 5%) + grayscale($color) + + compliment($color) + $invert(color) + + mix($a, $b, 50%) + + hue($color) + saturation($color) + lightness($color) + alpha($color) /* aka opacity() */ + + fade-in($color, 0.5) + fade-out($color, 0.5) + + adjust-color($color, $blue: 5) + adjust-color($color, $lightness: -30%) + adjust-color($color, $alpha: -0.4) + adjust-color($color, $hue: 30deg) + adjust-hue($color, 15deg) + +http://sass-lang.com/documentation/Sass/Script/Functions.html + ### Compass: Sprites @import compass/utilities/sprites diff --git a/vimscript-snippets.md b/vimscript-snippets.md index 4fc348057..af333395f 100644 --- a/vimscript-snippets.md +++ b/vimscript-snippets.md @@ -2,6 +2,48 @@ title: Vimscript snippets --- +## Functions + +### Inspecting the buffer + + getline('.') + getline(1) + getline(1, 0) + line('.') " current line number + search("^$") " next blank line + + getcurpos() " [bufnum, lnum, col, off, curswant] + getpos('.') + + expand('') " word under cursor + expand("%") " current file + +### Command line + + + +### Files + + fnameescape("string") + fnamemodify("main.c", ":p:h") + filereadable(fname) + fnamemodify(fname, ':e') " current file extension - see expand() + getfsize('file.txt') + getcwd() + +### Math + + fmod(9, 2) " modulus + floor(1.84) + ceil(1.84) + abs(-0.5) + +### Strings + + if a =~ '\s*' + +## Binding + ### Bind function to key and command command! YoFunctionHere call s:YoFunctionHere() @@ -9,11 +51,33 @@ title: Vimscript snippets function! s:FunctionHere() endfunction -### Stuff +## Executing - expand('') " word under cursor +### Execute normal keystrokes - filereadable(fname) - fnamemodify(fname, ':e') " current file extension - see expand() +### Running commands + + normal 'ddahello' + exe 'normal ^C' " with expansions + wincmd J + +### Call a function in insert mode + + inoremap X =script#myfunction() + inoremap =MyVimFunc()?'':'' + +### Checking plugins + + if globpath(&rtp, "plugin/commentary.vim") != "" + +## Autoload + + " autoload/hello.vim + if exists("g:hello_loaded") | finish | endif + let g:hello_loaded=1 + + function hello#method() + endfunction + + " calling hello#method() will load only if autoload() - expand("%") " current file diff --git a/yargs.md b/yargs.md index 4d0f143d1..aab180387 100644 --- a/yargs.md +++ b/yargs.md @@ -23,7 +23,8 @@ var argv = require('yargs') .describe('v', 'show version information') // help text - .help('h') + .alias('h', 'help') + .help('help') .usage('Usage: $0 -x [num]') .showHelpOnFail(false, "Specify --help for available options") ``` @@ -53,7 +54,8 @@ var argv = require('yargs') // more help .example('...') .epilog('copyright 2015') - .command('start', start a server') + .command('start', 'start a server') +``` ### Stacking