Improve layout.
This commit is contained in:
parent
8b013c0f92
commit
5f5d24a6b1
|
@ -1,2 +1,3 @@
|
|||
_output
|
||||
_site
|
||||
_/site
|
||||
|
|
94
Gemfile.lock
94
Gemfile.lock
|
@ -1,94 +0,0 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
activesupport (4.0.4)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
minitest (~> 4.2)
|
||||
multi_json (~> 1.3)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 0.3.37)
|
||||
atomic (1.1.16)
|
||||
blankslate (2.1.2.4)
|
||||
classifier (1.3.4)
|
||||
fast-stemmer (>= 1.0.0)
|
||||
colorator (0.1)
|
||||
commander (4.1.6)
|
||||
highline (~> 1.6.11)
|
||||
fast-stemmer (1.0.2)
|
||||
ffi (1.9.3)
|
||||
gemoji (1.5.0)
|
||||
github-pages (16)
|
||||
RedCloth (= 4.2.9)
|
||||
jekyll (= 1.4.3)
|
||||
jekyll-mentions (= 0.0.5)
|
||||
jekyll-redirect-from (= 0.3.1)
|
||||
jemoji (= 0.0.10)
|
||||
kramdown (= 1.3.1)
|
||||
liquid (= 2.5.5)
|
||||
maruku (= 0.7.0)
|
||||
rdiscount (= 2.1.7)
|
||||
redcarpet (= 2.3.0)
|
||||
highline (1.6.21)
|
||||
html-pipeline (1.5.0)
|
||||
activesupport (>= 2)
|
||||
nokogiri (~> 1.4)
|
||||
i18n (0.6.9)
|
||||
jekyll (1.4.3)
|
||||
classifier (~> 1.3)
|
||||
colorator (~> 0.1)
|
||||
commander (~> 4.1.3)
|
||||
liquid (~> 2.5.5)
|
||||
listen (~> 1.3)
|
||||
maruku (~> 0.7.0)
|
||||
pygments.rb (~> 0.5.0)
|
||||
redcarpet (~> 2.3.0)
|
||||
safe_yaml (~> 0.9.7)
|
||||
toml (~> 0.1.0)
|
||||
jekyll-mentions (0.0.5)
|
||||
html-pipeline (~> 1.5.0)
|
||||
jekyll (~> 1.4.3)
|
||||
jekyll-redirect-from (0.3.1)
|
||||
jekyll (~> 1.4)
|
||||
jemoji (0.0.10)
|
||||
gemoji (~> 1.5.0)
|
||||
html-pipeline (~> 1.5.0)
|
||||
jekyll (~> 1.4.3)
|
||||
kramdown (1.3.1)
|
||||
liquid (2.5.5)
|
||||
listen (1.3.1)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
rb-kqueue (>= 0.2)
|
||||
maruku (0.7.0)
|
||||
mini_portile (0.5.3)
|
||||
minitest (4.7.5)
|
||||
multi_json (1.9.2)
|
||||
nokogiri (1.6.1)
|
||||
mini_portile (~> 0.5.0)
|
||||
parslet (1.5.0)
|
||||
blankslate (~> 2.0)
|
||||
posix-spawn (0.3.8)
|
||||
pygments.rb (0.5.4)
|
||||
posix-spawn (~> 0.3.6)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
rb-fsevent (0.9.4)
|
||||
rb-inotify (0.9.3)
|
||||
ffi (>= 0.5.0)
|
||||
rb-kqueue (0.2.2)
|
||||
ffi (>= 0.5.0)
|
||||
rdiscount (2.1.7)
|
||||
redcarpet (2.3.0)
|
||||
safe_yaml (0.9.7)
|
||||
thread_safe (0.3.1)
|
||||
atomic (>= 1.1.7, < 2)
|
||||
toml (0.1.1)
|
||||
parslet (~> 1.5.0)
|
||||
tzinfo (0.3.39)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
github-pages
|
8
Makefile
8
Makefile
|
@ -1,6 +1,4 @@
|
|||
all:
|
||||
jekyll build
|
||||
PORT := 3000
|
||||
|
||||
watch:
|
||||
jekyll serve &
|
||||
git ls-files | entr make
|
||||
start:
|
||||
env BUNDLE_GEMFILE=./_/Gemfile bundle exec jekyll serve --drafts --watch --port ${PORT}
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
activesupport (4.1.6)
|
||||
i18n (~> 0.6, >= 0.6.9)
|
||||
json (~> 1.7, >= 1.7.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (~> 1.1)
|
||||
blankslate (2.1.2.4)
|
||||
celluloid (0.15.2)
|
||||
timers (~> 1.1.0)
|
||||
classifier-reborn (2.0.1)
|
||||
fast-stemmer (~> 1.0)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.7.0)
|
||||
colorator (0.1)
|
||||
execjs (2.2.1)
|
||||
fast-stemmer (1.0.2)
|
||||
ffi (1.9.3)
|
||||
gemoji (2.1.0)
|
||||
github-pages (28)
|
||||
RedCloth (= 4.2.9)
|
||||
jekyll (= 2.4.0)
|
||||
jekyll-coffeescript (= 1.0.0)
|
||||
jekyll-mentions (= 0.1.3)
|
||||
jekyll-redirect-from (= 0.6.2)
|
||||
jekyll-sass-converter (= 1.2.0)
|
||||
jekyll-sitemap (= 0.6.0)
|
||||
jemoji (= 0.3.0)
|
||||
kramdown (= 1.3.1)
|
||||
liquid (= 2.6.1)
|
||||
maruku (= 0.7.0)
|
||||
pygments.rb (= 0.6.0)
|
||||
rdiscount (= 2.1.7)
|
||||
redcarpet (= 3.1.2)
|
||||
html-pipeline (1.9.0)
|
||||
activesupport (>= 2)
|
||||
nokogiri (~> 1.4)
|
||||
i18n (0.6.11)
|
||||
jekyll (2.4.0)
|
||||
classifier-reborn (~> 2.0)
|
||||
colorator (~> 0.1)
|
||||
jekyll-coffeescript (~> 1.0)
|
||||
jekyll-gist (~> 1.0)
|
||||
jekyll-paginate (~> 1.0)
|
||||
jekyll-sass-converter (~> 1.0)
|
||||
jekyll-watch (~> 1.1)
|
||||
kramdown (~> 1.3)
|
||||
liquid (~> 2.6.1)
|
||||
mercenary (~> 0.3.3)
|
||||
pygments.rb (~> 0.6.0)
|
||||
redcarpet (~> 3.1)
|
||||
safe_yaml (~> 1.0)
|
||||
toml (~> 0.1.0)
|
||||
jekyll-coffeescript (1.0.0)
|
||||
coffee-script (~> 2.2)
|
||||
jekyll-gist (1.1.0)
|
||||
jekyll-mentions (0.1.3)
|
||||
html-pipeline (~> 1.9.0)
|
||||
jekyll (~> 2.0)
|
||||
jekyll-paginate (1.0.0)
|
||||
jekyll-redirect-from (0.6.2)
|
||||
jekyll (~> 2.0)
|
||||
jekyll-sass-converter (1.2.0)
|
||||
sass (~> 3.2)
|
||||
jekyll-sitemap (0.6.0)
|
||||
jekyll-watch (1.1.1)
|
||||
listen (~> 2.7)
|
||||
jemoji (0.3.0)
|
||||
gemoji (~> 2.0)
|
||||
html-pipeline (~> 1.9)
|
||||
jekyll (~> 2.0)
|
||||
json (1.8.1)
|
||||
kramdown (1.3.1)
|
||||
liquid (2.6.1)
|
||||
listen (2.7.9)
|
||||
celluloid (>= 0.15.2)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
maruku (0.7.0)
|
||||
mercenary (0.3.4)
|
||||
mini_portile (0.6.0)
|
||||
minitest (5.4.2)
|
||||
nokogiri (1.6.2.1)
|
||||
mini_portile (= 0.6.0)
|
||||
parslet (1.5.0)
|
||||
blankslate (~> 2.0)
|
||||
posix-spawn (0.3.8)
|
||||
pygments.rb (0.6.0)
|
||||
posix-spawn (~> 0.3.6)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
rb-fsevent (0.9.4)
|
||||
rb-inotify (0.9.5)
|
||||
ffi (>= 0.5.0)
|
||||
rdiscount (2.1.7)
|
||||
redcarpet (3.1.2)
|
||||
safe_yaml (1.0.1)
|
||||
sass (3.2.19)
|
||||
thread_safe (0.3.4)
|
||||
timers (1.1.0)
|
||||
toml (0.1.1)
|
||||
parslet (~> 1.5.0)
|
||||
tzinfo (1.2.2)
|
||||
thread_safe (~> 0.1)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
github-pages
|
|
@ -0,0 +1,19 @@
|
|||
{% include head.html %}
|
||||
|
||||
<div class='blog-header'>
|
||||
<div>
|
||||
<h1><a href="/">{{ site.meta.name }}</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='article-item -cheatsheet'>
|
||||
<div class='article-headline -cheatsheet'>
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
|
||||
<div class='article-content -cheatsheet'>
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include foot.html %}
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
html_class: home
|
||||
---
|
||||
{% include head.html %}
|
||||
|
||||
<div class='blog-header'>
|
||||
<div>
|
||||
<h1><a href="/">{{ site.meta.name }}</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='pages-list'>
|
||||
{% for page in site.pages %}
|
||||
<a href=".{{ page.url }}">
|
||||
<span class='title'>{{ page.title }}</span>
|
||||
<span class='date'>{{ page.url }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% include foot.html %}
|
21
_config.yml
21
_config.yml
|
@ -1,8 +1,29 @@
|
|||
# files
|
||||
layouts: ./_/layouts
|
||||
destination: ./_/site
|
||||
sass:
|
||||
sass_dir: ./_/sass
|
||||
|
||||
# Markdown
|
||||
highlighter: pygments
|
||||
markdown: kramdown
|
||||
kramdown:
|
||||
input: GFM
|
||||
hard_wrap: false
|
||||
parse_block_html: true
|
||||
use_coderay: true
|
||||
|
||||
coderay:
|
||||
coderay_line_numbers: nil
|
||||
coderay_line_numbers_start: 1
|
||||
coderay_tab_width: 4
|
||||
coderay_bold_every: 10
|
||||
coderay_css: class
|
||||
|
||||
defaults:
|
||||
- scope:
|
||||
path: ""
|
||||
values:
|
||||
layout: "default"
|
||||
meta:
|
||||
name: "Cheatsheets"
|
||||
|
|
|
@ -3,7 +3,30 @@
|
|||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>{{ page.title }} cheatsheet</title>
|
||||
<link href="assets/style.css" rel="stylesheet" />
|
||||
<link href="http://ricostacruz.com/assets/article.css" rel="stylesheet" />
|
||||
<style>
|
||||
.article-content pre, .with-footnote pre , .panorama-section pre , .article-content > .panorama-section pre {
|
||||
/*max-width: 900px; */
|
||||
}
|
||||
.article-content pre > code, .with-footnote pre > code, .panorama-section pre > code, .article-content > .panorama-section pre > code {
|
||||
background: transparent;
|
||||
overflow: visible;
|
||||
border-left-width: 3px;
|
||||
border-top: solid 1px #eee;
|
||||
border-top-left-radius: 3px;
|
||||
padding-bottom: 0;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.article-headline h1:after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 80px;
|
||||
height: 1px;
|
||||
background: #ddd;
|
||||
margin: 40px auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='all'>
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
{% include head.html %}
|
||||
|
||||
<a class='back' href='.'>Index</a>
|
||||
|
||||
<div class='header'>
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
|
||||
<div class='content'>
|
||||
{{ content }}
|
||||
</div>
|
||||
|
||||
{% include foot.html %}
|
|
@ -1,16 +0,0 @@
|
|||
---
|
||||
html_class: home
|
||||
---
|
||||
{% include head.html %}
|
||||
|
||||
<div class='header'>
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
|
||||
<div class='pages'>
|
||||
{% for page in site.pages %}
|
||||
<a href=".{{ page.url }}">{{ page.title }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% include foot.html %}
|
|
@ -16,15 +16,28 @@
|
|||
}
|
||||
})();
|
||||
|
||||
/* unorphan */
|
||||
(function () {
|
||||
if (!window.JekyllEscape) return;
|
||||
var tags = document.querySelectorAll('pre code, pre span');
|
||||
var els = document.querySelectorAll('h1 a, h1, h2, p.brief-intro, .pull-quote');
|
||||
for (var i = 0, len = els.length; i < len; i++) {
|
||||
var el = els[i];
|
||||
var last = el.lastChild;
|
||||
|
||||
for (var i=0, len=tags.length; i<len; i++) {
|
||||
var tag = tags[i];
|
||||
if (~tag.innerHTML.indexOf('{\\%'))
|
||||
tag.innerHTML = tag.innerHTML.replace(/{\\%/g, '{%');
|
||||
if (~tag.innerHTML.indexOf('{\\{'))
|
||||
tag.innerHTML = tag.innerHTML.replace(/{\\{/g, '{{');
|
||||
if (last && last.nodeType === 3) {
|
||||
console.log('=>', last.nodeValue, last.nodeValue.replace(/\s+([^\s]+\s*)$/g, '\xA0$1'));
|
||||
last.nodeValue = last.nodeValue.replace(/\s+([^\s]+\s*)$/g, '\xA0$1');
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
/* loaded */
|
||||
document.documentElement.className += ' loaded';
|
||||
|
||||
/* hljs */
|
||||
(function () {
|
||||
var codes = document.querySelectorAll('pre > code');
|
||||
for (var i = 0, len = codes.length; i < len; i++) {
|
||||
var block = codes[i];
|
||||
hljs.highlightBlock(block);
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
title: Atom
|
||||
layout: default
|
||||
---
|
||||
|
||||
### Symbols view
|
||||
|
||||
- `^ ⌥ down` - jump to declaration under cursor
|
||||
- `^ ⇧ r` - show tags
|
||||
|
||||
### Bracket matcher
|
||||
|
||||
- `^ m` - go to matching bracket
|
||||
- `^ ]` - remove brackets from selection
|
||||
- `^ ⌘ m` - select inside brackets
|
||||
- `⌥ ⌘ .` - close tag
|
|
@ -32,6 +32,7 @@ Max:
|
|||
.col-sm-1
|
||||
.col-md-1
|
||||
.col-lg-1
|
||||
.col-md-offset-1
|
||||
|
||||
.make-xs-column(12)
|
||||
.make-sm-column(6)
|
||||
|
|
|
@ -3,6 +3,7 @@ title: editorconfig
|
|||
layout: default
|
||||
---
|
||||
|
||||
### Example
|
||||
|
||||
```conf
|
||||
# top-most EditorConfig file
|
||||
|
@ -33,5 +34,21 @@ indent_style = space
|
|||
indent_size = 2
|
||||
```
|
||||
|
||||
### Properties
|
||||
|
||||
```conf
|
||||
indent_style = {space|tab}
|
||||
indent_size = {4|tab}
|
||||
tab_width = 2
|
||||
end_of_line = {cr|lf|crlf}
|
||||
charset = {utf-8|utf-16be|utf-16le|latin1}
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
```
|
||||
|
||||
### References
|
||||
|
||||
See: http://EditorConfig.org
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
title: Firebase
|
||||
layout: default
|
||||
---
|
||||
|
||||
wip
|
||||
|
||||
### Starting
|
||||
|
||||
``` coffee
|
||||
Fb = new Firebase('https://xxx.firebase.io')
|
||||
Fb.auth(TOKEN, (err, result) -> ...)
|
||||
.authAnonymously(...)
|
||||
.authWithPassword(...)
|
||||
.authWithOAuthPopup(...)
|
||||
.authWithOAuthToken(...)
|
||||
```
|
||||
|
||||
### Updating values
|
||||
|
||||
``` coffee
|
||||
Users = Fb.child('users')
|
||||
|
||||
# create
|
||||
user = Users.push(first: "Frank", last: "Sinatra")
|
||||
|
||||
# retrieve
|
||||
user = Users.child('alan') # gets `users/alan`
|
||||
|
||||
# setting
|
||||
user
|
||||
.set(first: "Miles", last: "Davis")
|
||||
.update(first: "Miles")
|
||||
.setWithPriority({ ... }, priority)
|
||||
|
||||
|
||||
# destroy
|
||||
user.remove()
|
||||
|
||||
# getting
|
||||
user.name() # primary id
|
||||
|
||||
user.once 'value', (snap) ->
|
||||
snap.name() # primary id
|
||||
snap.val() # value
|
||||
, (err) ->
|
||||
|
||||
# traversal
|
||||
user.parent()
|
||||
```
|
||||
|
||||
### Querying
|
||||
|
||||
```coffee
|
||||
Users = Fb.child('users')
|
||||
Users
|
||||
.startAt(1000)
|
||||
.limit(50)
|
||||
.equalTo(priority, [name])
|
||||
.on 'child_added', (snap) -> ...
|
||||
```
|
||||
### Lists
|
||||
|
||||
```coffee
|
||||
Posts = Fb.child('posts')
|
||||
post = Posts.push({ title: "How to do things", author: "alan" })
|
||||
```
|
||||
|
||||
### References
|
||||
|
||||
* https://www.firebase.com/docs/web/api/
|
||||
* https://www.firebase.com/docs/web/recipes.html
|
|
@ -69,7 +69,7 @@ layout: default
|
|||
|
||||
heroku apps # list
|
||||
heroku apps:create [NAME]
|
||||
heroku apps:destroy
|
||||
heroku apps:destroy --app APP
|
||||
heroku apps:info
|
||||
heroku apps:open # open in browser
|
||||
heroku apps:rename NEWNAME
|
||||
|
|
38
jekyll.md
38
jekyll.md
|
@ -11,22 +11,28 @@ jekyll_escape: true
|
|||
|
||||
### Directories
|
||||
|
||||
_config.yml
|
||||
|
||||
_drafts/
|
||||
|
||||
_includes/
|
||||
header.html
|
||||
footer.html
|
||||
|
||||
_layouts/
|
||||
default.html
|
||||
|
||||
_posts/
|
||||
2013-09-02-hello.md
|
||||
|
||||
_site/
|
||||
...
|
||||
./
|
||||
├── _config.yml
|
||||
│
|
||||
├── _data/
|
||||
│ └── ...
|
||||
│
|
||||
├── _drafts/
|
||||
│ └── ...
|
||||
│
|
||||
├── _posts/
|
||||
│ └── 2014-01-01-hello.md
|
||||
│
|
||||
├── _layouts/
|
||||
│ ├── default.html
|
||||
│ └── post.html
|
||||
│
|
||||
├── _includes/ - partials
|
||||
│ ├── header.html
|
||||
│ └── footer.html
|
||||
│
|
||||
└── _site/
|
||||
└── ...
|
||||
|
||||
## [Front-matter](http://jekyllrb.com/docs/frontmatter/)
|
||||
|
||||
|
|
|
@ -39,3 +39,7 @@ Simple:
|
|||
ledger r -p 01/26
|
||||
ledger r -p yesterday
|
||||
|
||||
Switches:
|
||||
|
||||
# what's everything I got in USD? (--exchange)
|
||||
ledger b Assets -X USD
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: Node.js - assert
|
||||
layout: default
|
||||
---
|
||||
|
||||
assert(val)
|
||||
assert.equal(actual, expected)
|
||||
assert.notEqual(a, e)
|
||||
|
||||
assert.deepEqual(a, e)
|
||||
assert.notDeepEqual(a, e)
|
||||
|
||||
assert.throws(fn)
|
||||
|
||||
### References
|
||||
|
||||
- http://nodejs.org/api/assert.html
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
title: Node.js - fs
|
||||
layout: default
|
||||
---
|
||||
|
||||
### Reading
|
||||
|
||||
fs.readFile('file.txt', function(err, data) { .. });
|
||||
fs.readFile('file.txt', {encoding: 'utf-8'}, function(err, data) { .. });
|
||||
|
||||
### Writing
|
||||
|
||||
fs.writeFile('output.txt', function(err) { .. });
|
||||
fs.appendFile('output.txt', function(err) { .. });
|
||||
|
||||
### Watch
|
||||
|
||||
fs.watch('dir OR file.txt', { persistent: true }, function(event, file) {
|
||||
event; /* rename | change */
|
||||
});
|
||||
|
||||
### Getting info
|
||||
|
||||
fs.exists('file.txt', function(exists /*bool*/) { ... });
|
||||
|
||||
fs.stat('file.txt', function(stats) {
|
||||
stats.isFile();
|
||||
stats.isDirectory();
|
||||
stats.isSymbolicLink();
|
||||
});
|
||||
|
||||
### File operations
|
||||
|
||||
fs.rename('old.txt', 'new.txt', function(){});
|
||||
fs.chown('file.txt', uid, gid, function(){});
|
||||
fs.symlink('src', 'dest', function(){});
|
||||
fs.unlink('path', function(){});
|
||||
fs.rmdir('path', function(){});
|
||||
|
||||
fs.readdir('path', function(err, files) { .. }); /* `files` = array of names */
|
||||
|
||||
### Path
|
||||
|
||||
fs.realpath('/etc/passwd', function(err, path) { /* "/private/etc/passwd" */ });
|
||||
|
||||
### Sync
|
||||
|
||||
data = fs.readFileSync('input.txt');
|
||||
fs.writeFileSync('output.txt', data);
|
||||
fs.appendFileSync('output.txt', data);
|
||||
fs.existsSync('file.txt');
|
||||
|
||||
### References
|
||||
|
||||
- http://nodejs.org/api/fs.html
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
title: Node.js - path
|
||||
layout: default
|
||||
---
|
||||
|
||||
fs.realpath('/etc/passwd', function(err, path) { /* "/private/etc/passwd" */
|
||||
});
|
||||
|
||||
dir = path.join('etc', 'passwd');
|
||||
dir = path.resolve('/etc', 'passwd', '..', 'var');
|
||||
|
||||
path.dirname('/etc/passwd') //=> "/etc"
|
||||
path.basename('/etc/passwd') //=> "passwd"
|
||||
path.basename('/etc/rc.d', '.d') //=> "rc"
|
||||
|
||||
### References
|
||||
|
||||
- http://nodejs.org/api/path.html
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
title: Node.js - process
|
||||
layout: default
|
||||
---
|
||||
|
||||
### Streams
|
||||
|
||||
process.stdout.write('...');
|
||||
process.stderr.write('...');
|
||||
|
||||
function stdin(fn) {
|
||||
var data = '';
|
||||
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('readable', function() {
|
||||
var chunk = process.stdin.read();
|
||||
if (chunk !== null) data += chunk;
|
||||
});
|
||||
|
||||
process.stdin.on('end', function() {
|
||||
fn(null, data);
|
||||
});
|
||||
}
|
||||
|
||||
### stuff
|
||||
|
||||
process.argv; //=> ['node', 'file.js', 'one', 'two']
|
||||
process.env; //=> {TERM: 'screen-256color', SHELL: '/bin/bash', ...}
|
||||
|
||||
process.exit();
|
||||
process.exit(1);
|
||||
|
||||
### Directories
|
||||
|
||||
process.cwd(); //=> "/tmp"
|
||||
process.chdir('dir');
|
||||
|
||||
### References
|
||||
|
||||
- http://nodejs.org/api/process.html
|
109
nodejs.md
109
nodejs.md
|
@ -8,100 +8,6 @@ layout: default
|
|||
__filename
|
||||
__dirname
|
||||
|
||||
## [fs]
|
||||
|
||||
### Reading
|
||||
|
||||
fs.readFile('file.txt', function(err, data) { .. });
|
||||
fs.readFile('file.txt', {encoding: 'utf-8'}, function(err, data) { .. });
|
||||
|
||||
### Writing
|
||||
|
||||
fs.writeFile('output.txt', function(err) { .. });
|
||||
fs.appendFile('output.txt', function(err) { .. });
|
||||
|
||||
### Watch
|
||||
|
||||
fs.watch('dir OR file.txt', { persistent: true }, function(event, file) {
|
||||
event; /* rename | change */
|
||||
});
|
||||
|
||||
### Getting info
|
||||
|
||||
fs.exists('file.txt', function(exists /*bool*/) { ... });
|
||||
|
||||
fs.stat('file.txt', function(stats) {
|
||||
stats.isFile();
|
||||
stats.isDirectory();
|
||||
stats.isSymbolicLink();
|
||||
});
|
||||
|
||||
### File operations
|
||||
|
||||
fs.rename('old.txt', 'new.txt', function(){});
|
||||
fs.chown('file.txt', uid, gid, function(){});
|
||||
fs.symlink('src', 'dest', function(){});
|
||||
fs.unlink('path', function(){});
|
||||
fs.rmdir('path', function(){});
|
||||
|
||||
fs.readdir('path', function(err, files) { .. }); /* `files` = array of names */
|
||||
|
||||
### Path
|
||||
|
||||
fs.realpath('/etc/passwd', function(err, path) { /* "/private/etc/passwd" */ });
|
||||
|
||||
### Sync
|
||||
|
||||
data = fs.readFileSync('input.txt');
|
||||
fs.writeFileSync('output.txt', data);
|
||||
fs.appendFileSync('output.txt', data);
|
||||
fs.existsSync('file.txt');
|
||||
|
||||
## [process]
|
||||
|
||||
### Streams
|
||||
|
||||
process.stdout.write('...');
|
||||
process.stderr.write('...');
|
||||
|
||||
function stdin(fn) {
|
||||
var data = '';
|
||||
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('readable', function() {
|
||||
var chunk = process.stdin.read();
|
||||
if (chunk !== null) data += chunk;
|
||||
});
|
||||
|
||||
process.stdin.on('end', function() {
|
||||
fn(null, data);
|
||||
});
|
||||
}
|
||||
|
||||
### stuff
|
||||
|
||||
process.argv; //=> ['node', 'file.js', 'one', 'two']
|
||||
process.env; //=> {TERM: 'screen-256color', SHELL: '/bin/bash', ...}
|
||||
|
||||
process.exit();
|
||||
process.exit(1);
|
||||
|
||||
### Directories
|
||||
|
||||
process.cwd(); //=> "/tmp"
|
||||
process.chdir('dir');
|
||||
|
||||
## [path]
|
||||
|
||||
fs.realpath('/etc/passwd', function(err, path) { /* "/private/etc/passwd" */ });
|
||||
|
||||
dir = path.join('etc', 'passwd');
|
||||
dir = path.resolve('/etc', 'passwd', '..', 'var');
|
||||
|
||||
path.dirname('/etc/passwd') //=> "/etc"
|
||||
path.basename('/etc/passwd') //=> "passwd"
|
||||
path.basename('/etc/rc.d', '.d') //=> "rc"
|
||||
|
||||
### exec
|
||||
|
||||
var exec = require('child_process').exec,
|
||||
|
@ -115,17 +21,6 @@ layout: default
|
|||
}
|
||||
});
|
||||
|
||||
## [assert]
|
||||
|
||||
assert(val)
|
||||
assert.equal(actual, expected)
|
||||
assert.notEqual(a, e)
|
||||
|
||||
assert.deepEqual(a, e)
|
||||
assert.notDeepEqual(a, e)
|
||||
|
||||
assert.throws(fn)
|
||||
|
||||
## Snippets
|
||||
|
||||
info = require('../package.json')
|
||||
|
@ -152,7 +47,3 @@ layout: default
|
|||
});
|
||||
|
||||
[all]: http://nodejs.org/api/all.html
|
||||
[path]: http://nodejs.org/api/path.html
|
||||
[process]: http://nodejs.org/api/process.html
|
||||
[fs]: http://nodejs.org/api/fs.html
|
||||
[assert]: http://nodejs.org/api/assert.html
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
title: Sketch
|
||||
layout: default
|
||||
---
|
||||
|
||||
### Insert
|
||||
|
||||
- `V` vector
|
||||
- `P` pencil
|
||||
- `T` text
|
||||
- `L` line
|
||||
- `R` rect
|
||||
- `O` oval
|
||||
- `U` rounded
|
||||
|
||||
### Show
|
||||
|
||||
- `^G` grid
|
||||
- `^L` layout
|
||||
- `^P` pixels
|
||||
- `^H` selection handles
|
||||
- `^R` rulers
|
||||
|
||||
### Sidebars
|
||||
|
||||
- `⌘⌥1` toggle left (layers)
|
||||
- `⌘⌥2` toggle right (inspector)
|
||||
- `⌘⌥3` toggle both
|
||||
- `⌘.` presentation
|
||||
|
||||
### Zoom
|
||||
|
||||
- `⌘0` 100%
|
||||
- `⌘1` fit to screen
|
||||
- `⌘2` fit selection to screen
|
||||
- `⌘3` center selection
|
||||
|
||||
### Arrange
|
||||
|
||||
- `⌘⌥ up/dn` forward or backward
|
||||
- `^⌘⌥ up/dn` front or back
|
||||
|
||||
### Distribute
|
||||
|
||||
- `^⌘H` horizontal
|
||||
- `^⌘V` vertical
|
||||
|
||||
### Layers
|
||||
|
||||
- `⌘R` rename
|
||||
- `⌘F` find
|
||||
|
||||
- `⌘G` group
|
||||
- `⌘⇧G` ungroup
|
||||
|
||||
### Font
|
||||
|
||||
- `⌘⌥ +/-` bigger/smaller
|
||||
- `⌘⇧[` left
|
||||
- `⌘⇧\` center
|
||||
- `⌘⇧]` right
|
|
@ -61,8 +61,13 @@ layout: default
|
|||
› ›
|
||||
• ·
|
||||
|
||||
⌘
|
||||
⌥
|
||||
⌘ – ⌘ – ⌘ – Command Key
|
||||
⌥ – ⌥ – ⌥ – Option Key
|
||||
⇧ – ⇧ – ⇧ – Shift Key
|
||||
⎋ – ⎋ – ⎋ – ESC Key
|
||||
⇪ – ⇪ – ⇪ – Capslock
|
||||
⏎ – ⏎ – ⏎ – Return
|
||||
⌫ – ⌫ – ⌫ – Delete / Backspace
|
||||
|
||||
▸ \u25b8
|
||||
▹
|
||||
|
|
Loading…
Reference in New Issue