Update.
This commit is contained in:
parent
b67f66f0cd
commit
6916d06e48
|
@ -0,0 +1,26 @@
|
|||
# Ansi codes
|
||||
|
||||
Format
|
||||
|
||||
\033[#m
|
||||
|
||||
Where:
|
||||
|
||||
0 clear
|
||||
1 bold
|
||||
4 underline
|
||||
5 blink
|
||||
|
||||
30-37 fg color
|
||||
40-47 bg color
|
||||
|
||||
Colors
|
||||
|
||||
0 black
|
||||
1 red
|
||||
2 green
|
||||
3 yellow
|
||||
4 blue
|
||||
5 magenta
|
||||
6 cyan
|
||||
7 white
|
15
brew.md
15
brew.md
|
@ -1,6 +1,21 @@
|
|||
title: Brew
|
||||
---
|
||||
|
||||
### Commands
|
||||
|
||||
brew unlink git
|
||||
brew link git
|
||||
|
||||
brew list # List all installed
|
||||
|
||||
brew list --versions git # See what versions of `git` you have
|
||||
brew info git # List versions, caveats, etc
|
||||
brew cleanup git # Remove old versions
|
||||
brew edit git # Edit this formula
|
||||
brew home git # Open homepage
|
||||
|
||||
### Stuff
|
||||
|
||||
Nice Homebrew packages:
|
||||
|
||||
* `tig` - Git "GUI" for the console
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
### Compiling
|
||||
|
||||
$ cpp -P file > outfile
|
||||
|
||||
### Includes
|
||||
|
||||
#include "file"
|
||||
|
||||
### Defines
|
||||
|
||||
#define FOO
|
||||
#define FOO "hello"
|
||||
|
||||
#undef FOO
|
||||
|
||||
### If
|
||||
|
||||
#ifdef DEBUG
|
||||
console.log('hi');
|
||||
#elif defined VERBOSE
|
||||
...
|
||||
#else
|
||||
...
|
||||
#endif
|
||||
|
||||
### Error
|
||||
|
||||
#if VERSION == 2.0
|
||||
#error Unsupported
|
||||
#warning Not really supported
|
||||
#endif
|
||||
|
||||
### Macro
|
||||
|
||||
#define DEG(x) ((x) * 57.29)
|
||||
|
||||
### Token concat
|
||||
|
||||
#define DST(name) name##_s name##_t
|
||||
DST(object); #=> "object_s object_t;"
|
||||
|
||||
### file and line
|
||||
|
||||
#define LOG(msg) console.log(__FILE__, __LINE__, msg)
|
||||
#=> console.log("file.txt", 3, "hey")
|
33
chai.md
33
chai.md
|
@ -52,20 +52,25 @@ title: Chai
|
|||
|
||||
### Expectations
|
||||
|
||||
.equal(expected)
|
||||
.eql // deepequal
|
||||
.deep.equal(expected)
|
||||
.be.a('string')
|
||||
.include(val)
|
||||
.be.ok(val)
|
||||
.be.true
|
||||
.be.false
|
||||
.be.null
|
||||
.be.undefined
|
||||
.exist
|
||||
.be.empty
|
||||
.be.arguments
|
||||
expect(10).above(5)
|
||||
expect(object)
|
||||
.equal(expected)
|
||||
.eql // deepequal
|
||||
.deep.equal(expected)
|
||||
.be.a('string')
|
||||
.include(val)
|
||||
|
||||
.be.ok(val)
|
||||
.be.true
|
||||
.be.false
|
||||
|
||||
.be.null
|
||||
.be.undefined
|
||||
.be.empty
|
||||
.be.arguments
|
||||
.be.function
|
||||
|
||||
.exist
|
||||
expect(10).above(5)
|
||||
|
||||
|
||||
### References
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# Commander.js
|
||||
|
||||
### Initialize
|
||||
|
||||
var cli = require('commander');
|
||||
|
||||
### Options
|
||||
|
||||
cli
|
||||
.version(require('../package').version)
|
||||
.usage('[options] <command>')
|
||||
.option('-w, --words <n>', 'generate <n> words')
|
||||
.option('-i, --interval <n>', 'interval [1000]', 1000)
|
||||
.option('-s, --symbols', 'include symbols')
|
||||
.parse(process.argv);
|
||||
|
||||
### Help
|
||||
|
||||
.on('--help', function() {
|
||||
console.log('');
|
||||
})
|
||||
|
||||
### Commands
|
||||
|
||||
cli.outputHelp();
|
||||
cli.args == ["hello"];
|
||||
|
||||
### Other useful things
|
||||
|
||||
process.exit(0);
|
||||
|
||||
|
13
cron.md
13
cron.md
|
@ -24,3 +24,16 @@ title: Cron
|
|||
*/15 * * * * every 15 mins
|
||||
0 */2 * * * every 2 hours
|
||||
0 0 0 * 0 every sunday midnight
|
||||
|
||||
@reboot every reboot
|
||||
|
||||
### crontab
|
||||
|
||||
# Adding tasks easily
|
||||
echo "@reboot echo hi" | crontab
|
||||
|
||||
# Open in editor
|
||||
crontab -e
|
||||
|
||||
# List tasks
|
||||
crontab -l [-u user]
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
# irc.freenode.net
|
||||
|
||||
/msg nickserv identify [nick] <password>
|
||||
/msg nickserv info <nick>
|
||||
|
||||
### Add a nick
|
||||
|
||||
/nick newnick
|
||||
/msg nickserv identify <oldnick> <password>
|
||||
/msg nickserv group
|
|
@ -0,0 +1,30 @@
|
|||
# JavaScript arrays
|
||||
|
||||
array = [a,b,c,d,e]
|
||||
|
||||
array[1] //=> b
|
||||
array.indexOf(b) //=> 1
|
||||
|
||||
### Subsets
|
||||
|
||||
array.slice(1) //=> [b,c,d,e]
|
||||
array.slice(1,2) //=> [b]
|
||||
|
||||
re = array.splice(1) // re = [b,c,d,e] array == [a]
|
||||
re = array.splice(1,2) // re = [b,c] array == [a,d,e]
|
||||
|
||||
### Adding items
|
||||
|
||||
array.push(Z) // array == [a,b,c,d,e,Z]
|
||||
array.unshift(Z) // array == [Z,a,b,c,d,e]
|
||||
|
||||
array.concat([F,G]) //=> [a,b,c,d,e,F,G]
|
||||
|
||||
### Taking items
|
||||
|
||||
array.pop() //=> e array == [a,b,c,d]
|
||||
array.shift() //=> a array == [b,c,d,e]
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
---
|
||||
title: Jekyll
|
||||
---
|
||||
|
||||
### Installation
|
||||
|
||||
$ gem install jekyll
|
||||
|
||||
### Directories
|
||||
|
||||
_config.yml
|
||||
|
||||
_drafts/
|
||||
|
||||
_includes/
|
||||
header.html
|
||||
footer.html
|
||||
|
||||
_layouts/
|
||||
default.html
|
||||
|
||||
_posts/
|
||||
2013-09-02-hello.md
|
||||
|
||||
_site/
|
||||
...
|
||||
|
||||
Frontmatter
|
||||
-----------
|
||||
|
||||
---
|
||||
layout: post
|
||||
title: Hello
|
||||
---
|
||||
|
||||
### Other frontmatter stuff
|
||||
|
||||
permalink: '/hello'
|
||||
published: false
|
||||
category: apple
|
||||
categories: ['html', 'css']
|
||||
tags: ['html', 'css']
|
||||
|
||||
### Reference
|
||||
|
||||
* [Front-matter](http://jekyllrb.com/docs/frontmatter/)
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
source: .
|
||||
destination: _site
|
||||
exclude: [dir, file, ...]
|
||||
include: ['.htaccess']
|
||||
|
||||
### Reference
|
||||
|
||||
* [Configuration](http://jekyllrb.com/docs/configuration/)
|
||||
|
||||
Variables
|
||||
---------
|
||||
|
||||
{{ site }} - from config.yml
|
||||
{{ page }} - from frontmatter, and page-specific info
|
||||
{{ content }} - html content (use in layouts)
|
||||
{{ paginator }} - ...
|
||||
|
||||
### Site
|
||||
|
||||
{{ site.time }} - current time
|
||||
{{ site.pages }} - list of pages
|
||||
{{ site.posts }} - list of posts
|
||||
{{ site.related_posts }} - list
|
||||
{{ site.categories.CATEGORY }} - list
|
||||
{{ site.tags.TAG }} - list
|
||||
|
||||
### Page
|
||||
|
||||
{{ page.content }} - un-rendered content
|
||||
{{ page.title }}
|
||||
{{ page.excerpt }} - un-rendered excerpt
|
||||
{{ page.url }}
|
||||
{{ page.date }}
|
||||
{{ page.id }}
|
||||
{{ page.categories }}
|
||||
{{ page.tags }}
|
||||
{{ page.path }}
|
||||
|
||||
### Paginator
|
||||
|
||||
{{ paginator.per_page }}
|
||||
{{ paginator.posts }}
|
||||
...
|
||||
|
||||
Sample code
|
||||
-----------
|
||||
|
||||
### Loops
|
||||
|
||||
{% for post in site.posts %}
|
||||
<a href="{{ post.url }}">
|
||||
<h2>{{ post.title }} — {{ post.date | date_to_string }}</h2>
|
||||
</a>
|
||||
{{ post.content }}
|
||||
{% endfor %}
|
||||
|
||||
### Dates
|
||||
|
||||
{{ page.date | date: "%b %d, %Y" }}
|
||||
|
||||
### If
|
||||
|
||||
{% if page.image.feature %}
|
||||
{% else %}
|
||||
{% endif %}
|
||||
|
||||
### Includes
|
||||
|
||||
{% include header.html %}
|
||||
|
||||
Integration
|
||||
-----------
|
||||
|
||||
### Bundler
|
||||
|
||||
# _plugins/bundler.rb
|
||||
require "bunder/setup"
|
||||
Bundler.require :default
|
||||
|
||||
### Compass
|
||||
|
||||
https://gist.github.com/parkr/2874934
|
||||
https://github.com/matthodan/jekyll-asset-pipeline
|
|
@ -0,0 +1,104 @@
|
|||
24 classical micronutrients
|
||||
---------------------------
|
||||
|
||||
### Vitamin D
|
||||
|
||||
* Sources: sunlight, fish/eggs
|
||||
* Dosage: 2000iu daily (10,000iu max)
|
||||
* Major benefits: test boost
|
||||
* Fat-soluble
|
||||
* Best taken with meals or a source of fat
|
||||
|
||||
### Zinc
|
||||
|
||||
* Sources: meat, egg, legumes
|
||||
* Major benefits: test boost, immune boost
|
||||
* Doesn't go well with [Iron](#iron)
|
||||
* Dosage: 5-10mg daily
|
||||
|
||||
### Magnesium
|
||||
|
||||
* Sources: grains, nuts, leafy vegetables
|
||||
* Dosage: 200-450mg daily
|
||||
* Major benefits: lower blood glucose
|
||||
|
||||
### Selenium
|
||||
|
||||
* Sources:
|
||||
* Major benefits: anti-oxidant, anti-cancer
|
||||
* Dosage: 200-300ug daily
|
||||
|
||||
### Vitamin E
|
||||
|
||||
* Sources: Nuts, needs, veg oils, leafy veggies
|
||||
* Major benefits: anti-oxidant, skin
|
||||
* Dosage: 15mg daily (RDA)
|
||||
* Fat-soluble
|
||||
|
||||
### Vitamin C
|
||||
|
||||
* Sources: fruits (esp citrus), leafy veggies
|
||||
* Dosage: 75mg daily (females), 90mg (males)
|
||||
* Major benefits: anti-oxidant
|
||||
|
||||
### Vitamin K
|
||||
|
||||
* Sources: beans (legumes), green tea, veggies (mostly leafy), egg yolk,
|
||||
chicken thigh
|
||||
* Major benefits: bone health
|
||||
* Fat-soluble
|
||||
|
||||
### Vitamin B12
|
||||
|
||||
### Vitamin B6
|
||||
|
||||
### Thiamin (Vitamin B1)
|
||||
|
||||
### Riboflavin (Vitamin B2)
|
||||
|
||||
### Potassium
|
||||
|
||||
### Omega 3
|
||||
|
||||
### Calcium
|
||||
|
||||
* Sources: dairy
|
||||
* Dosage: 1000mg daily for adults
|
||||
* Major benefits: bone mass/strength
|
||||
|
||||
### Iodine
|
||||
|
||||
* Sources: dairy (yogurt, milk, eggs)
|
||||
* Major benefits: thyroid gland regulation
|
||||
|
||||
### Vitamin A
|
||||
|
||||
* Sources: meat, poultry, fish, fruits, leafy veggies, orange veggies
|
||||
(squash/carrots)
|
||||
* Dosage: 10,000iu for adults
|
||||
* Major benefits: vision, immune boost, reproduction
|
||||
* Fat-soluble
|
||||
|
||||
### Iron
|
||||
|
||||
* Sources: soybeans, nuts/beans/lentils, beef, whole grains
|
||||
* Major benefits: oxygen transport, energy metabolism
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
* Examine:
|
||||
[K](http://examine.com/supplements/Vitamin+K/)
|
||||
[C](http://examine.com/supplements/Vitamin+C/)
|
||||
[Sel](http://examine.com/supplements/Selenium/)
|
||||
[D](http://examine.com/supplements/Vitamin+D/)
|
||||
[Zinc](http://examine.com/supplements/Zinc/)
|
||||
[Mg](http://examine.com/supplements/Magnesium/)
|
||||
* Nih.gov:
|
||||
[E](http://ods.od.nih.gov/factsheets/VitaminE-HealthProfessional/)
|
||||
[Ca](http://ods.od.nih.gov/factsheets/calcium.asp)
|
||||
[A](http://ods.od.nih.gov/factsheets/Vitam-HealthProfessional/)
|
||||
* Whfoods.com:
|
||||
[I](http://www.whfoods.com/genpage.php?tname=nutrient&dbid=69)
|
||||
[Fe](http://www.whfoods.com/genpage.php?tname=nutrient&dbid=70)
|
||||
|
13
nodejs.md
13
nodejs.md
|
@ -126,3 +126,16 @@ title: NodeJS api
|
|||
info.version
|
||||
|
||||
process.stdout.write(util.inspect(objekt, false, Infinity, true) + '\n');
|
||||
|
||||
## Spawn
|
||||
|
||||
var spawn = require('child_process').spawn;
|
||||
var proc = spawn(bin, argv, { stdio: 'inherit' });
|
||||
proc.on('error', function(err) {
|
||||
if (err.code == "ENOENT") { "does not exist" }
|
||||
if (err.code == "EACCES") { "not executable" }
|
||||
});
|
||||
proc.on('exit', function(code) { ... });
|
||||
|
||||
// also { stdio: [process.stdin, process.stderr, process.stdout] }
|
||||
|
||||
|
|
10
sinon.md
10
sinon.md
|
@ -30,6 +30,10 @@ title: Sinon
|
|||
|
||||
sinon.stub($, 'ajax', function() { return 'x' });
|
||||
|
||||
### Fake date
|
||||
|
||||
sinon.useFakeTimers(+new Date(2011,9,1));
|
||||
|
||||
### Fake server
|
||||
|
||||
server = sinon.fakeServer.create();
|
||||
|
@ -47,3 +51,9 @@ title: Sinon
|
|||
|
||||
xhr = sinon.useFakeXMLHttpRequest();
|
||||
xhr.restore();
|
||||
|
||||
### Sandbox
|
||||
|
||||
beforeEach -> global.sinon = require('sinon').sandbox.create()
|
||||
afterEach -> global.sinon.restore()
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# Spreadsheet macros
|
||||
|
||||
### If
|
||||
|
||||
=IF(test, then, else)
|
||||
=IF(EQ(A1, "paid"), "true", "false")
|
||||
|
||||
### Comparators
|
||||
|
||||
=EQ(a,b) NE()
|
||||
=GT() GTE() LT() LTE()
|
||||
|
||||
### Math
|
||||
|
||||
=POW(2, 32) # 2^32
|
||||
=SIN() ACOS() etc
|
||||
=CEILING(n,sig,mode)
|
||||
=FLOOR(n,sig,mode)
|
||||
=INT(n)
|
||||
|
||||
=SUM(range)
|
||||
|
||||
=SUMIF(range, criteria, sum_range)
|
||||
=SUMIF(A1:A5, ">300", B1:B5) # if A# is >300, use B#
|
||||
|
||||
### Core
|
||||
|
||||
=TO_DATE(number)
|
||||
|
||||
### Vlook
|
||||
|
||||
=VLOOKUP(value, range, column_index)
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
# Underscore-string
|
||||
|
||||
### Usage
|
||||
|
||||
// Use it like so:
|
||||
_.str.trim("hey");
|
||||
_s.trim("hey");
|
||||
|
||||
// Unless you do:
|
||||
_.mixin(_.string.exports());
|
||||
|
||||
// So you can:
|
||||
_.trim("hey");
|
||||
_("hey").trim();
|
||||
|
||||
### Trimming
|
||||
|
||||
_.truncate("Hello world", 4) // => "Hell..."
|
||||
_.prune("Hello world", 5) // => "Hello..."
|
||||
|
||||
_.trim(" foo ") // => "foo"
|
||||
_.trim("-foo-", '-') // => "foo"
|
||||
_.ltrim
|
||||
_.rtrim
|
||||
|
||||
### Numbers
|
||||
|
||||
_.numberFormat(1000, 2) // => "1,000.00"
|
||||
|
||||
### Caps
|
||||
|
||||
_.capitalize("foo bar") // => "Foo Bar"
|
||||
_.humanize("hey-there foo") // => "Hey there foo"
|
||||
_.titleize('My name is hi') // => "My Name Is Hi"
|
||||
|
||||
_.dasherize('MozTransform') // => "-moz-transform"
|
||||
_.underscored('MozTransform') // => "moz_transform"
|
||||
_.classify('-moz-transform') // => "MozTransform"
|
||||
_.camelize('moz_transform') // => "MozTransform"
|
||||
|
||||
_.slugify("hey there") // => "hey-there"
|
||||
|
||||
_.swapCase("hELLO") // => "Hello"
|
||||
|
||||
### Checks
|
||||
|
||||
_.startsWith('image.gif', 'image') // => true
|
||||
_.endsWith('image.gif', '.gif') // => true
|
||||
_.isBlank(" ") // => true (also for "\n", "")
|
||||
|
||||
### HTML
|
||||
|
||||
_.escapeHTML("<div>")
|
||||
_.unescapeHTML("<div>")
|
||||
_.stripTags("<div>hi</div>")
|
||||
|
||||
### Quote
|
||||
|
||||
_.quote("hi", '"') // => '"hi"'
|
||||
_.unquote('"hi"') // => "hi"
|
||||
|
||||
### Splits
|
||||
|
||||
_.lines("hi\nthere") // => ["hi","there"]
|
||||
_.words("hi there you") // => ["hi","there","you"]
|
||||
|
||||
### Sprintf
|
||||
|
||||
_.sprintf("%.1f", 1.17)
|
||||
|
||||
### Pad
|
||||
|
||||
_.pad("1", 8) // => " 1"
|
||||
_.pad("1", 8, "0") // => "00000001"
|
||||
_.pad("1", 8, " ", "right") // => "1 "
|
||||
_.pad("1", 8, " ", "both") // => " 1 "
|
||||
|
||||
_.lpad(..) // same as _.pad(.., 'left')
|
||||
_.rpad(..) // same as _.pad(.., 'right')
|
||||
_.lrpad(..) // same as _.pad(.., 'both')
|
||||
|
||||
### References
|
||||
|
||||
* https://github.com/epeli/underscore.string
|
|
@ -17,3 +17,5 @@
|
|||
✓ check or tick mark ✓
|
||||
❌ cross mark ❌
|
||||
💬 speech balloon 💬
|
||||
|
||||
✈'
|
||||
|
|
31
vim.md
31
vim.md
|
@ -85,7 +85,34 @@ Marks
|
|||
`. # Last change
|
||||
`` # Last jump
|
||||
|
||||
Calculator
|
||||
----------
|
||||
### Calculator
|
||||
|
||||
(Insert mode) <C-r>=128/2
|
||||
|
||||
### Highlights
|
||||
|
||||
hi Comment
|
||||
term=bold,underline
|
||||
gui=bold
|
||||
ctermfg=4
|
||||
guifg=#80a0ff
|
||||
|
||||
### Filetype detection
|
||||
|
||||
augroup filetypedetect
|
||||
au! BufNewFile,BufRead *.json setf javascript
|
||||
augroup END
|
||||
|
||||
au Filetype markdown setlocal spell
|
||||
|
||||
### Conceal
|
||||
|
||||
set conceallevel=2
|
||||
syn match newLine "<br>" conceal cchar=}
|
||||
hi newLine guifg=green
|
||||
|
||||
### Region conceal
|
||||
|
||||
syn region inBold concealends matchgroup=bTag start="<b>" end="</b>"
|
||||
hi inBold gui=bold
|
||||
hi bTag guifg=blue
|
||||
|
|
Loading…
Reference in New Issue