This commit is contained in:
Rico Sta. Cruz 2014-02-25 18:32:14 +08:00
parent 3c0a6a3c1f
commit 70ea6d8bed
53 changed files with 2303 additions and 39 deletions

View File

@ -8,6 +8,10 @@ Allows you to filter listings by a certain scope.
scope :draft
scope :for_approval
scope :public, if: ->{ current_admin_user.can?(...) }
scope "Unapproved", :pending
scope("Published") { |books| books.where(:published: true) }
### Sidebar filters
filter :email

View File

@ -17,6 +17,11 @@ Where:
30-37 fg color
40-47 bg color
1K clear line (to beginning of line)
2K clear line (entire line)
2J clear screen
0;0H move cursor to 0;0
Colors
0 black

13
ansible-examples.md Normal file
View File

@ -0,0 +1,13 @@
---
title: Ansible examples
layout: default
---
### Examples
* [Ruby]( https://github.com/chelsea/ansible-example-ruby/blob/master/roles/webserver/tasks/main.yml )
* [Postgres]( https://github.com/chelsea/ansible-example-ruby/blob/master/roles/db/tasks/main.yml )
https://github.com/tingtun/ansible-playbook-gitlab

80
ansible-guide.md Normal file
View File

@ -0,0 +1,80 @@
---
title: Ansible: getting started
layout: default
---
### Install Ansible
~~~ sh
$ brew install ansible # OSX
$ [sudo] pip install ansible # elsewhere
~~~
### Start your project
~~~ sh
~$ mkdir setup
~$ cd setup
~~~
### Create an inventory file
This is a list of hosts you want to manage, grouped into groups. (Hint: try
using 127.0.0.1 to deploy to your local machine)
~~~ dosini
# ~/setup/hosts
[sites]
127.0.0.1
192.168.0.1
192.168.0.2
192.168.0.3
~~~
### Create your first Playbook
~~~ yaml
# ~/setup/playbook.yml
- hosts: 127.0.0.1
user: root
tasks:
- name: install nginx
apt: pkg=nginx state=present
- name: start nginx every bootup
service: name=nginx state=started enabled=yes
- name: do something in the shell
shell: echo hello > /tmp/abc.txt
- name: install bundler
gem: name=bundler state=latest
~~~
### Run it
~~~ sh
~/setup$ ls
hosts
playbook.yml
~/setup$ ansible-playbook -i hosts playbook.yml
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [install nginx] *********************************************************
ok: [127.0.0.1]
TASK: start nginx every bootup] ***********************************************
ok: [127.0.0.1]
...
~~~
### Read more
* http://lowendbox.com/blog/getting-started-with-ansible/
* http://www.ansibleworks.com/docs/modules.html

60
ansible-modules.md Normal file
View File

@ -0,0 +1,60 @@
---
title: Ansible modules
layout: default
---
### Aptitude
- apt_key: id=AC40B2F7 url="http://..."
state=present
- apt: pkg=nodejs state=present
state=present # absent | latest
update_cache=yes
force=no
- apt_repository: repo='deb https://... raring main'
state=present
### file
- file:
state=directory # file | link | hard | touch | absent
path=/etc/dir
owner=bin
group=wheel
mode=0644
recurse=yes # mkdir -p
force=yes # ln -nfs
- copy:
src=/app/config/nginx.conf
dest=/etc/nginx/nginx.conf
- template:
src=config/redis.j2
dest=/etc/redis.conf
### git
- git: repo=git://github.com/
dest=/srv/checkout
version=master
depth=10
bare=yes
### user
- user: state=present name=git
system=yes
shell=/bin/sh
comment="Git Version Control"
### service
- service: name=nginx state=started [enabled=yes]
### shell
- shell: apt-get install nginx -y
- script: /x/y/script.sh

20
ansible-roles.md Normal file
View File

@ -0,0 +1,20 @@
---
title: Ansible roles
layout: default
---
### Structure
roles/
common/
tasks/
handlers/
files/ # 'copy' will refer to this
templates/ # 'template' will refer to this
meta/ # Role dependencies here
vars/
defaults/main.yml
### References
* http://www.ansibleworks.com/docs/playbooks_roles.html

96
ansible.md Normal file
View File

@ -0,0 +1,96 @@
---
title: Ansible
layout: default
---
## Getting started
### Hosts
$ sudo mkdir /etc/ansible
$ sudo vim /etc/ansible/hosts
[example]
192.0.2.101
192.0.2.102
### Running a playbook
$ ansible-playbook playbook.yml
## Tasks
- hosts: all
user: root
sudo: no
vars:
aaa: bbb
tasks:
- ...
handlers:
- ...
### Includes
tasks:
- include: db.yml
handlers:
- include: db.yml user=timmy
## Handlers
handlers:
- name: start apache2
action: service name=apache2 state=started
tasks:
- name: install apache
action: apt pkg=apache2 state=latest
notify:
- start apache2
## Vars
- host: lol
vars_files:
- vars.yml
vars:
project_root: /etc/xyz
tasks:
- name: Create the SSH directory.
file: state=directory path=${project_root}/home/.ssh/
only_if: "$vm == 0"
## Roles
- host: xxx
roles:
- db
- { role:ruby, sudo_user:$user }
- web
# Uses:
# roles/db/tasks/*.yml
# roles/db/handlers/*.yml
### Task: Failures
- name: my task
command: ...
register: result
failed_when: "'FAILED' in result.stderr"
ignore_errors: yes
changed_when: "result.rc != 2"
### Env vars
vars:
local_home: "{{ lookup('env','HOME') }}"
## Refereneces
* http://www.ansibleworks.com/docs/intro_configuration.html
* http://www.ansibleworks.com/docs/modules.html

21
bookshelf-contrib.md Normal file
View File

@ -0,0 +1,21 @@
# bookshelf-contrib.Scopes
#
class Books
scopes:
published: (q) -> q.where(published: true)
Books.published().fetchAll()
# bookshelf-contrib.QueryProxy
#
Books.query().where(published: true)
Books.where(published: true)
# bookshelf-contrib.Migration
class Migration
up: ->
down: ->

View File

@ -51,11 +51,27 @@ layout: default
global_defs:
DEBUG: false
## Stuff
## Extensions
Compile to JS/CSS
* uglify-js-brunch
* stylus-brunch
* coffee-script-brunch
* less-brunch
Compile to HTML
* static-jade-brunch
Embedded templates
* emblem-brunch
Etc
* uglify-js-brunch
* jshint-brunch
* imageoptimizer-brunch
## References

50
chai.md
View File

@ -55,8 +55,8 @@ layout: default
expect(object)
.equal(expected)
.eql // deepequal
.deep.equal(expected)
.eql
.deep.equal(expected) // same as .eql
.be.a('string')
.include(val)
@ -69,10 +69,54 @@ layout: default
.be.empty
.be.arguments
.be.function
.be.instanceOf
.gt(5) # or .above .greaterThan
.gte # or .at.least
.lt(5) # or .below
.respondTo('bar')
.satisfy (n) -> n > 0
.have.members([2, 3, 4])
.have.keys(['foo'])
.have.key('foo')
.exist
expect(10).above(5)
### Chai-jQuery
global.jQuery = ...;
chai.use(require('chai-jquery'));
expect($body)
.have.attr('foo')
.have.prop('disabled')
.have.css('background')
.have.css('background-color', '#ffffff')
.have.data('foo')
.have.class('active')
.have.id('id')
.have.html('<em>hi</em>')
.have.text('hello')
.have.value('2013')
.be.visible
.be.hidden
.be.checked
.be.selected
.be.enabled
.be.disabled
.be.empty
.to.exist
.to.contain('text')
.to.have('.selector')
### References

30
css.md
View File

@ -3,6 +3,36 @@ title: CSS
layout: default
---
Selectors
---------
= [attr="value"] - exact
~= [class~="box"] - has word
|= [class|="icon"] - exact, or prefix (eg, value-)
$= [href$=".doc"] - ends in
*= [class*="-is-"] - contains
+ adjacent sibling
~ far sibling
> direct child
:target (h2#foo:target)
:disabled
:nth-child
:nth-child(3n)
:nth-child(3n+2)
:nth-child(-n+4)
:nth-last-child(...)
:first-of-type
:last-of-type
:nth-of-type
:only-of-type - only child of its parent thats like that
:only-child
Background
----------

27
emacs.md Normal file
View File

@ -0,0 +1,27 @@
---
title: Emacs
layout: default
---
### Movements
^n ^p # up/down
^f ^b # left/right
^v Mv # up/down page
^a ^e # begin/end of line
Ma Me # begin/end of sentence
### Basic
^x ^f # find file
^x ^s # save file
### Command line
Mx
### Packages
Mx package-install RET evil RET

67
ember.md Normal file
View File

@ -0,0 +1,67 @@
---
title: Ember.js
layout: default
---
### Routes
App.Router.map(function() {
this.resource('trips', function() {
this.route('item', { path: '/:trip_id' });
});
this.route('upcoming');
this.route('about', { path: '/about' });
this.route('schedules');
this.route('history');
this.route('post');
});
### A route
App.IndexRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('title', 'my app');
// <h1>{{title}}</h1>
},
setupController: function(controller, model) {
controller.set("model", model);
this.controllerFor('topPost').set('model', model);
},
model: function(params) {
return this.store.find('posts');
return this.store.find('post', params.post_id);
},
serialize: function(model) {
// this will make the URL `/posts/foo-post`
return { post_slug: model.get('slug') };
}
});
### markup
<img {{bindAttr src="avatarURL}}>
<button {{action follow}}>
### View
App.InfoView = Ember.View.extend({
templateName: 'input', /* optional */
fooName: "Hello" /* {{ view.fooName }} */
click: function(e) {
"I was clicked";
}
});
{{view Ember.TextField class="input block"
valuebinding="emailAddresses" placeholder="Enter your friends's
emails here!" autofocus=true}}
<button {{action invite emailAddresses}} class="btn big success">Invite your friends</button>
<a href="#" {{action set "isEditingContacts" true target="view"}}

60
factory_girl.md Normal file
View File

@ -0,0 +1,60 @@
---
title: FactoryGirl
layout: default
---
### Paths
test/factories.rb
spec/factories.rb
test/factories/*.rb
spec/factories/*.rb
### Defining stuff
FactoryGirl.define do
factory ...
end
### Factories
# This will guess the User class
factory :user do
first_name "John"
last_name { %w[Doe Smith Doyle].shuffle }
admin false
# Sequences
sequence(:username) { |n| "user#{n}" }
# Associations
association :author
association :author, factory: user, last_name: "Ho"
author
# Traits
trait :admin do
admin true
end
after :create do |user, evaluator| ... end
after :build
end
factory :user, aliases: [:author, :commenter] do ... end
factory :admin_user, parent: :user do .. end
### Using
FactoryGirl.build(:user)
build(:user) # not saved
create(:user) # saved
attributes_for(:user) # hash
build_stubbed(:user) # stubbed out attributes
build(:user, name: "John")
create_list(:user, 3)
build_list(:user, 3)

35
ffmpeg.md Normal file
View File

@ -0,0 +1,35 @@
---
title: Ffmpeg
layout: default
---
### Common switches
-codecs # list codecs
-c:v # video codec (-vcodec) - 'copy' to copy stream
-c:a # audio codec (-acodec)
-fs SIZE # limit file size (bytes)
-b:v 1M # video bitrate (1M = 1Mbit/s)
-b:a 1M # audio bitrate
-aspect RATIO # aspect ratio (4:3, 16:9, or 1.25)
-r RATE # frame rate per sec
-s WIDTHxHEIGHT # frame size
-vn # no video
-aq QUALITY # audio quality (codec-specific)
-ar 44100 # audio sample rate (hz)
-ac 1 # audio channels (1=mono, 2=stereo)
-an # no audio
-vol N # volume (256=normal)
### Ringtone conversion using ffmpeg
ffmpeg -i foo.mp3 -ac 1 -ab 128000 -f mp4 -acodec libfaac -y target.m4r
### To webm
ffmpeg -i input.mp4 -vcodec libvpx -acoder libvorbis output.webm

19
gh-pages.md Normal file
View File

@ -0,0 +1,19 @@
---
title: GitHub pages
layout: default
---
$ echo "foobar.com" > CNAME
$ git commit && git push
Subdomain (like www):
CNAME => username.github.io
Apex domains:
ALIAS => username.github.io
Apex domains (alternative):
A => 192.30.252.153, 192.30.252.154

4
git.md
View File

@ -14,3 +14,7 @@ layout: default
# Update remote URLs in .gitmodules
# (Use when you changed remotes in submodules)
git submodule sync
## Cherry pick
git rebase 76acada^

9
github.md Normal file
View File

@ -0,0 +1,9 @@
---
title: GitHub
layout: default
---
### URLs
github.com/:userrepo/blame/:branch/:path
github.com/:userrepo/commit/:commit

View File

@ -3,13 +3,24 @@ title: Google Analytics
layout: default
---
### Pageview
// Analytics.js
ga('create', 'UA-XXXX-Y', 'auto');
ga('send', 'pageview');
### Track events
// ga.js
// [..., category, action, label, value (int), noninteraction (bool)]
_gaq.push(['_trackEvent', 'Videos', 'Play', 'Birthday video', true])
_gaq.push(['_trackEvent', 'Projects', 'Donate', 'Project name'])
_gaq.push(['_trackEvent', 'Accounts', 'Login'])
// Analytics.js
// , , category, action, label, value (int)
ga('send', 'event', 'button', 'click', 'nav buttons', 4);
### Variables
// [..., index, name, value, scope (optional)]

115
gulp.md Normal file
View File

@ -0,0 +1,115 @@
---
title: Gulp
---
* gulp-ruby-sass
* gulp-autoprefixer
* gulp-minify-css
* gulp-jshint
* gulp-concat
* gulp-uglify
* gulp-imagemin
* gulp-livereload (requires tiny-lr)
* gulp-clean
* gulp-cache
* gulp-notify
* gulp-header (headers in files)
* gulp-mocha
* gulp-stylus
* gulp-compass
* gulp-nodemon
* gulp-size (displays size)
Example
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
livereload = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
// Styles
gulp.task('styles', function() {
return gulp.src('src/styles/main.scss')
.pipe(sass({ style: 'expanded', }))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('dist/styles'))
.pipe(rename({ suffix: '.min' }))
.pipe(minifycss())
.pipe(livereload(server))
.pipe(gulp.dest('dist/styles'))
.pipe(notify({ message: 'Styles task complete' }));
});
// Scripts
gulp.task('scripts', function() {
return gulp.src('src/scripts/**/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat('main.js'))
.pipe(gulp.dest('dist/scripts'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.pipe(livereload(server))
.pipe(gulp.dest('dist/scripts'))
.pipe(notify({ message: 'Scripts task complete' }));
});
// Images
gulp.task('images', function() {
return gulp.src('src/images/**/*')
.pipe(cache(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true })))
.pipe(livereload(server))
.pipe(gulp.dest('dist/images'))
.pipe(notify({ message: 'Images task complete' }));
});
// Clean
gulp.task('clean', function() {
return gulp.src(['dist/styles', 'dist/scripts', 'dist/images'], {read: false})
.pipe(clean());
});
// Default task
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts', 'images');
});
// Watch
gulp.task('watch', function() {
// Listen on port 35729
server.listen(35729, function (err) {
if (err) {
return console.log(err)
};
// Watch .scss files
gulp.watch('src/styles/**/*.scss', ['styles']);
// Watch .js files
gulp.watch('src/scripts/**/*.js', ['scripts']);
// Watch image files
gulp.watch('src/images/**/*', ['images']);
});
});
### References
https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md#getting-started

22
handlebarsjs.md Normal file
View File

@ -0,0 +1,22 @@
---
title: Handlebars.js
layout: default
---
### Helpers
Handlebars.registerHelper('link_to', function() {
return "<a href='" + this.url + "'>" + this.body + "</a>";
});
var context = { posts: [{url: "/hello-world", body: "Hello World!"}] };
var source = "<ul>{{#posts}}<li>{{{link_to}}}</li>{{/posts}}</ul>"
var template = Handlebars.compile(source);
template(context);
// Would render:
//
// <ul>
// <li><a href='/hello-world'>Hello World!</a></li>
// </ul>

19
harveyjs.md Normal file
View File

@ -0,0 +1,19 @@
---
title: Harvey.js
layout: default
---
### Harvey
http://harvesthq.github.io/harvey/harvey.js
### Usage
Harvey.attach('(min-width: 600px)', {
setup: function () {
},
on: function () {
},
off: function () {
}
})

View File

@ -23,6 +23,12 @@ layout: default
heroku logs -t # --tail (stream)
heroku logs -s app # --source (only on app logs)
## `releases`
heroku releases
heroku releases:info v25
heroku rollback
## `pg` - Postgresql
# Start a database

View File

@ -3,6 +3,16 @@ title: Imagemagick
layout: default
---
### Stuff
-resize 100x40
-flip # vertical
-flop # horizontal
-transpose # flip vertical + rotate 90deg
-transverse # flip horizontal + rotate 270deg
-trim # trim image edges
-rotate 90
### Resize to fit
convert input.jpg -resize 80x80^ -gravity center -extent 80x80 icon.png

25
inkscape.md Normal file
View File

@ -0,0 +1,25 @@
---
title: Inkscape
layout: default
---
### All
- = - Zoom in/out
3 4 - Zoom to selection / drawing
5 6 - Zoom to page / page width
### Select tool (F1)
[ ] - Rotate
### Edit path (F2)
Ctrl - constraint
Dragging an anchor handle
ctrl - snap to 15 degrees
alt - ?
### Bezier (Shift F6)

View File

@ -15,6 +15,7 @@ layout: default
array.slice(1) //=> [b,c,d,e]
array.slice(1,2) //=> [b]
// Destructive
re = array.splice(1) // re = [b,c,d,e] array == [a]
re = array.splice(1,2) // re = [b,c] array == [a,d,e]

60
js-model.md Normal file
View File

@ -0,0 +1,60 @@
---
title: Js-Model
layout: default
---
Project = Model "project", ->
@extend
findByTitle: (title) -> ...
@include
markAsDone: -> ...
# ActiveRecord::Base.include_root_in_json = false
});
project = Project.find(1)
project = Project.findByTitle("hello")
project.markAsDone()
### Persistence
Project "hi", ->
@persistence Model.REST, "/projects"
@persistence Model.localStorage
Project.load ->
// loaded
### Attrs
project = new Project(name: "Hello")
project.attr('name', "Hey")
project.attr('name')
project.save()
project.destroy()
### Collection
Food.add(egg)
Food.all()
Food.select (food) -> ...
Food.first()
Food.find(id)
### Events
Project.bind "add", (obj) ->
Project.bind "remove", (obj) ->
# Instances
project.bind "update", ->
project.bind "destroy", ->
project.trigger "turn_blue"
http://benpickles.github.io/js-model/

228
ledger.md Normal file
View File

@ -0,0 +1,228 @@
---
title: Ledger CLI
layout: default
---
### Queries
# any/all matches
ledger bal Rent Transportation # any
ledger bal Income and Job # all
ledger bal Expenses and not (Drinks or Food)
# what did I spend on most? (--sorted)
ledger reg Expenses -S amount
# how much do I have now?
ledger bal ^Assets ^Liabilities
# how much did I have at this date? (--end)
ledger bal -e 01/15 ^Assets ^Liabilities
# how much did I spend and earn this month?
ledger bal ^Expenses ^Income --invert
# what did I spend my Mastercard on? (--period, --begin, --end)
# ..list transactions in account "Mastercard" for this date.
ledger reg mastercard
ledger reg mastercard -p "january"
ledger reg mastercard -b 01/25 -e 01/31
# what did I do yesterday?
# ..list transactions on this day
ledger reg -p 01/26
# how much was spent on Expenses:Grocery?
ledger reg grocery
ledger reg grocery --weekly
ledger reg grocery --monthly
# how much was spent over the course of 3 days? (totalled)
ledger reg -b 01/25 -e 01/27 --subtotal
ledger reg -b 01/25 -e 01/27 --subtotal grocery
### Format
2013/01/03 * Rent for January
Expenses:Rent $600.00
Assets:Savings
* = cleared
! = pending
### Secondary dates
2008/01/01=2008/01/14 Client invoice ; estimated date you'll be paid
### Balance assertions
2008/01/01 * KFC
Expenses:Food $20
Assets:Cash $-20 = $500 ; ensures cash is at $500
### Balance assignment
2008/01/01 * Cash balance
Assets:Cash = $500
Equity:Adjustments
2008/01/01 * KFC
Expenses:Food $20
Assets:Cash = $500 ; figures out what's needed to make it $500
### Payables
2008/04/25 * Rent
(Assets:Checking) -$200
Expenses:Rent
### Commodities
; cost per item
2010/05/31 * Market
Assets:Fridge 35 apples @ $0.42
Assets:Cash
; total cost
2010/05/31 * Market
Assets:Fridge 35 apples @@ $14.70
Assets:Cash
; fixed lot prices
2010/05/31 * Gas
Expenses:Gasoline 11 GAL {=$2.299}
### Budgeting
~ Monthly
Expenses:Rent $500
Expenses:Food $100
Expenses $40 ; everything else
Assets
~ Yearly
; ledger bal --budget Expenses
; ledger bal --unbudgeted Expenses
### Comments
; line comment
# also line comment
% also line comment
| also line comment
* also line comment
CLI interface
-------------
### Examples
$ ledger bal # show balance
$ ledger reg grocery # show entries for grocery
$ ledger print # show entries
$ ledger bal assets # check if im broke
$2000 Assets
$1400 Savings
$600 Cash
$ ledger bal -b 2013/01/01 -e 2013/01/31
### Periods
[interval] [begin] [end]
interval:
every day|week|month|quarter|year
every N days|weeks|...
daily|weekly|...
begin:
from <spec>
end:
to <spec>
spec:
2004
2004/10/1
$ ledger bal|reg --period "until aug"
$ ledger bal|reg --period "last oct"
$ ledger bal|reg --period "every week"
### Register
$ ledger reg
-D, --daily
-W, --weekly
-M, --monthly
--quarterly
-Y, --yearly
-s, --subtotal
--start-of-week monday
-S, --sort date
-S, --sort amount
### Filters
-b, --begin DATE
-e, --end DATE
-d EXPR # only transactions matching EXPR (`-d payee =~ /pioneer/`)
-C, --cleared # only cleared transactions (with *)
-U, --uncleared # only uncleared (no *)
--pending # only pending (with !)
-R, --real # ignore virtual postings (eg: "(Cash) $-400")
-L, --actual # no automated postings (eg: "= /^Income/")
--aux-date # use aux dates as if it were the primary dates
-r, --related # show the other side
# "reg -r savings" shows where it comes from)
### Display
-n, --collapse # [register] collapse entries
# [balance] no grand total
-s, --subtotal # [balance] show sub-accounts
# [other] show subtotals
### Effective dates
Say you're in business. If you bill a customer, you can enter something like
2008/01/01=2008/01/14 Client invoice ; estimated date you'll be paid
Assets:Accounts Receivable $100.00
Income: Client name
Then, when you receive the payment, you change it to
2008/01/01=2008/01/15 Client invoice ; actual date money received
Assets:Accounts Receivable $100.00
Income: Client name
### CSV format
date, ?, desc, account, currency, amt, pending/cleared, ?
"2013/09/02","","things", "Assets:Cash","P","-2000","*",""
"2013/09/02","","things", "Liabilities:Card","P","-200","*",""
"2013/09/02","","things", "Expenses:Things","P","2200","*",""
"2013/09/04","","stuff", "Assets:Cash","P","-20","*",""
"2013/09/04","","stuff", "Expneses:Others","P","20","*",""
### Commodity
commodity $
note American Dollars
format $1,000.00
nomarket
default
### See
* http://ledger-cli.org/3.0/doc/ledger3.html
* https://gist.github.com/agaviria/3317397

View File

@ -18,8 +18,9 @@ layout: default
end
end
### Specs
### Specs (.must/.wont)
.must_be :==, 0
.must_equal b
.must_be_close_to 2.99999
.must_be_same_as b
@ -41,9 +42,74 @@ layout: default
proc { ... }.must_raise exception
proc { ... }.must_throw sym
Wont is the inverse of must:
a.must_equal b
a.wont_equal b
### Unit::TestCase
class TestHipster < MiniTest::Unit::TestCase
def setup
@subject = ["silly hats", "skinny jeans"]
end
def teardown
@hipster.destroy!
end
def test_for_helvetica_font
assert_equal "helvetica!", @hipster.preferred_font
end
def test_not_mainstream
refute @hipster.mainstream?
end
end
### Assertions
assert
assert_block { ... }
assert_empty
assert_equal 2, @size
assert_in_delta @size, 1, 1
assert_in_epsilon
assert_includes @list, "item"
assert_instance_of Array, @list
assert_kind_of Enumerable, @list
assert_match @str, /regex/
assert_nil
assert_operator @n, :==, 0
assert_output
assert_raises
assert_respond_to
assert_same
assert_send
assert_silent
assert_throws
### MiniTest::Mock
A simple and clean mock system. There two essential methods at our disposal: expect and verify.
require 'minitest/autorun'
describe Twipster, "Make every tweet a hipster tweet." do
before do
@twitter = MiniTest::Mock.new
@twipster = Twipster.new(@twitter)
end
it "should append a #lolhipster hashtag and update Twitter with our status" do
tweet = "Skyrim? Too mainstream."
@twitter.expect :update, true, ["#{tweet} #lolhipster"]
@twipster.submit(tweet)
assert @twitter.verify # verifies tweet and hashtag was passed to `@twitter.update`
end
end
### Reporters
gem 'minitest-reporters'
require 'minitest/reporters'
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
[Default, Spec, Progress, RubyMate, RubyMine, JUnit]

82
modella.md Normal file
View File

@ -0,0 +1,82 @@
---
title: Modella
layout: default
---
### Basic
User = Modella('User')
.attr('name')
.attr('email', { required: true })
.use(require('modella-validators')
.validator (u) ->
u.error('username', 'is required') unless u.has('username')
user
.name()
.name('John')
.set(name: 'John')
.has('name') //=> true
.isNew()
.isValid()
.save (err) ->
.remove (err) ->
.removed
.model // === User
### Events
Model.emit('event', [data...])
record.emit('event', [data...])
### List of events
user
.on 'save', ->
.on 'create', ->
.on 'saving', (data, done) -> done()
.on 'remove', ->
.on 'removing', (data, done) -> done()
.on 'valid', ->
.on 'invalid', ->
.on 'change', ->
.on 'change email', ->
.on 'initializing', (instance, attrs) ->
.on 'initialize', ->
.on 'error', -> failed to save model
.on 'setting', (instance, attrs) -> # on Model#set()
.on 'attr', -> # new attr via Model.attr()
### Plugins
MyPlugin = ->
return (Model) ->
Model.method = ...
Model.prototype.method = ...
Model.attr(...)
Model
### Memory
User
.all (err, users) ->
.find id, (err, user) ->
.remove ->
.save ->
.update ->

22
nock.md Normal file
View File

@ -0,0 +1,22 @@
---
title: Nock
layout: default
---
### Nock
scope = nock('http://foo.com')
scope = nock('http://foo.com', { allowUnmocked: true })
nock('http://foo.com')
.get('/user')
.reply(200, { id: 1234 })
### Filtering
nock('http://foo.com')
.filteringPath(/[&\?]token=[^&]*/g, '')
.get('/user')
# catches "/user?token=..." as well

View File

@ -61,14 +61,17 @@ layout: default
### Streams
process.stdout.write('...');
process.stderr.write('...');
function readStdin(fn) {
process.stdin.resume(); /* paused by default */
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) { ... });
process.stdin.on('end', function() { ... });
process.stdout.write('...');
process.stderr.write('...');
var data = '';
process.stdin.on('data', function(chunk) { data += chunk.toString(); });
process.stdin.on('end', function() { fn(null, data); });
}
### stuff
@ -125,7 +128,7 @@ layout: default
process.stdout.write(util.inspect(objekt, false, Infinity, true) + '\n');
## Spawn
## Spawn - passthru the in/out
var spawn = require('child_process').spawn;
var proc = spawn(bin, argv, { stdio: 'inherit' });
@ -137,6 +140,11 @@ layout: default
// also { stdio: [process.stdin, process.stderr, process.stdout] }
proc.stdout.on('data', function (data) {
});
proc.stderr.on('data', function (data) {
});
[all]: http://nodejs.org/api/all.html
[path]: http://nodejs.org/api/path.html
[process]: http://nodejs.org/api/process.html

25
npm.md
View File

@ -4,4 +4,27 @@ layout: default
---
npm install
npm owner add rstacruz PACKAGENAME
npm shrinkwrap
### Adding owners
# Add someone as an owner
npm owner add USERNAME PACKAGENAME
# list packages
npm ls
# Remove duplicates down the dep tree
npm dedupe
# Adds warning to those that install a package of old versions
npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
# Add a package as a git submodule
npm submodule PACKAGE
# update all packages, or selected packages
npm update [-g] PACKAGE
# Check for outdated packages
npm outdated [PACKAGE]

95
plantuml.md Normal file
View File

@ -0,0 +1,95 @@
---
title: PlantUML
layout: default
---
### Format
@startuml
Car : drive()
Dog : bark()
@enduml
# plantuml file.uml && open file.png
## Classes
* http://plantuml.sourceforge.net/classes.html
### Methods
Car : drive()
### Methods (alt)
class Car {
String make
year : Integer
void drive()
-private()
#protected()
~package private()
+public()
{static} String id
{abstract} void methods()
}
### Lines
class Car {
These are separated by lines.
The next line is a dotted line
..
Next is a double-stroke
==
Next is a plain line
--
Next is a strong line
__
You can make headers with it
.. header ..
}
### Associations
Car <|-- SmallCar # extension
Car *-- Engine # composition
Cars o-- Car # aggregation
Car <|.. SmallCar # dotted line (use .. instead of --)
Car <|--* Car
-left->
-right->
### Relations
Driver - Car : drives >
Car -- Owner : < owns
Car *-- Wheel : has 4 >
### Notes
class Car {
}
note left: Something something
note top of Car : This is a car.
### Namespaces
namespace Client {
class Driver {
}
}
Car -- Client.Driver : owns >
## Activities
(*) --> "First Activity"
-->[You can put also labels] "Second Activity"
--> (*)

14
premailer.md Normal file
View File

@ -0,0 +1,14 @@
---
title: Premailer
layout: default
---
-premailer-width
Available on table, th and td elements
-premailer-height
Available on table, tr, th and td elements
-premailer-cellpadding
Available on table elements
-premailer-cellspacing
Available on table elements

129
ractive.md Normal file
View File

@ -0,0 +1,129 @@
---
title: Ractive.js
layout: default
vim: ft=javascript
---
### Initialization
new Ractive({
el: $('..'),
el: '#box',
template: '...', // required
// callbacks
init: function() // on instanciate
complete: function() // on finish animations
// objs
data: { ... }
partials: { ... } // global: Ractive.partials
transitions: { ... } // global: Ractive.transitions
components: { ... }
adaptors: [ ... ]
// options
magic: false
modifyArrays: true
twoway: true
noIntro: true // true = disable transition on initial render
lazy: false // false = use keyevents, true = use change/blur
append: false // false = overwrite element, true = append
debug: false
sanitize: false
})
http://docs.ractivejs.org/latest/initialisation-options
### Components
Widget = Ractive.extend({ ... })
ractive = new Ractive({
el: 'main',
template: '<widget foo="bar"/>',
components: {
widget: Widget
}
});
https://github.com/RactiveJS/Ractive/issues/74
https://github.com/RactiveJS/Ractive/wiki/Components
### Partials
// Global partials
Ractive.partials.x = "<..>"
### Events
<button on-click='activate'>Activate!</button>
view.on({
activate: function () { ... }
});
<button on-click='sort:name'>Sort by name</button>
view.on('sort', function (e, column) {
console.log('sorting by #{column}');
});
### Observing
view.observe("name", function (name) {
console.log("Changed name to", name);
}, { init: false });
### Markup
Hello, {{name}}
Body: {{{unescaped}}}
<!-- each -->
{{#list:i}}
<li>{{this.name}}</li>
<li>{{name}}</li>
<li>{{.}}</li> <!-- same as 'this' -->
{{/#list}}
{{^user}}Not logged in{{/user}} <!-- if false -->
{{#user}}Welcome, sire{{/user}} <!-- if true -->
{{>partialName}}
<component>
{{#statusDogs[selected]}}
### Transformed attributes
This transforms the `list` attribute via a helper function called `sort()`.
{{# sort(list, "name") :num }}
<li>{{num}} - {{name}}</li>
{{/ end. any text goes here }}
data: {
sort: function(array, column) { return array.whatever(); }
}
### Transitions
<div intro="fade">
<div intro="bump">
<div intro="bump:{duration:400}">
Ractive.transitions.bump = function(t, params) {
params = t.processParams( params, {
duration: 400,
color: t.isIntro ? 'rgb(0,255,0)' : 'rgb(255,0,0)'
});
if (t.isIntro) {
/* enter */
} else {
/* exit */
}
t.complete();
};

View File

@ -6,17 +6,38 @@ layout: default
### Forms
# Model:
= form_for @post do |f|
form_for @post do |f|
= form_for @post, url: { method: 'put', action: 'create' }, html: { class: 'nifty_form'} do |f|
form_for @post,
url: { method: 'put', action: 'create' },
html: { class: 'nifty_form' } do |f|
f.label :first_name
f.text_field :first_name
field :multiselect, f, :first_name
### Stuff
f.object
### Fields
f.check_box :enabled
f.check_box :is_admin
f.text_field :title
f.text_area :body, \
:size => '60x12'
f.text_area :body,
size: '60x12'
f.label :post, :title
f.label :post, :title, "Title"
f.label :post, :title, "Title", class: "title"
f.label(:post, :terms) { "Accept terms" }
#=> <label for="post_title">Title</label>
radio_button("post", "category", "rails")
radio_button("post", "category", "java")
#=> <input type="radio" id="post_category_rails" name="post[category]"
# value="rails" checked="checked" />
### Select dropdowns
@ -32,4 +53,15 @@ layout: default
### The rest
f.submit "Create"
f.hidden_field
### I18n
helpers.submit.create = "Create a %{model}"
helpers.submit.update = "Confirm changes to %{model}"
helpers.submit.article.create = "Publish article"
helpers.submit.article.update = "Update article"
helpers.label.post.body = "Write your body text here"

26
rails-gems.md Normal file
View File

@ -0,0 +1,26 @@
---
title: Rails gems
layout: default
---
### Rico's preferred rails gems
Development:
gem 'spring' # code reloading
gem 'letter_opener'
gem 'better_errors'
gem 'meta-tags'
gem 'guard-rspec'
Prod:
gem 'kaminari' # pagination
gem 'devise'
gem 'meta-tags', require: 'meta_tags'
gem 'friendly_id'
gem 'bourbon'
gem 'neat'
gem 'turbolinks'
gem 'nkss_rails'
gem 'jquery-turbolinks'

55
rails-i18n.md Normal file
View File

@ -0,0 +1,55 @@
---
title: Rails i18n
layout: default
---
### Basics
t('my.messages.hello')
t(:hello, scope: 'my.messages')
t(:hello, scope: [:my, :messages])
t('my.messages.hello', default: "Hello")
### Plural
I18n.backend.store_translations :en, inbox: {
one: 'one message',
other: '%{count} messages'
}
I18n.translate :inbox, count: 1 # => 'one message'
I18n.translate :inbox, count: 2 # => '2 messages'
### ActiveRecord
activerecord.attributes.user.name
t 'blank', scope:
activerecord.errors.models.[model_name].attributes.[attribute_name]
activerecord.errors.models.[model_name]
activerecord.errors.messages
errors.attributes.[attribute_name]
errors.messages
helpers.submit.[model]:
create: "Create a %{model}"
update: "Update %{model}"
activerecord.errors.models.venue.attributes.name.blank = "Please enter a name."
confirmation - :confirmation
acceptance - :accepted
presence - :blank
length - :too_short (%{count})
length - :too_long (%{count})
length - :wrong_length (%{count})
uniqueness - :taken
format - :invalid
numericality - :not_a_number
activerecord.errors.template.header:
one: "1 error prohibited this %{model} from being saved"
### Reference
* http://guides.rubyonrails.org/i18n.html

80
rails-rspec.md Normal file
View File

@ -0,0 +1,80 @@
---
title: Rspec-rails
layout: default
---
### Require
require 'spec_helper'
### Controller tests
# spec/controllers/*
describe ItemsController do
it "works" do
get :index
expect(response).to be_success
expect(response.status).to eq(200)
expect(response).to render_template("index")
end
it "loads all of the posts into @posts" do
post1, post2 = Post.create!, Post.create!
get :index
expect(assigns(:posts)).to match_array([post1, post2])
end
end
### Request specs
# spec/features/*
describe "Foo tests", type: :request do
include RequestHelpers
it "should work" do
visit "/"
expect(page).to have_content "Hello"
expect(page).to have_selector "h1", text: "Welcome"
end
end
### View specs
# spec/views/*
it "renders _event partial for each event" do
assign(:events, [stub_model(Event), stub_model(Event)])
render
expect(view).to render_template(:partial => "_event", :count => 2)
end
### Routes
# spec/routes/*
describe "routing to profiles" do
it "routes /profile/:username to profile#show for username" do
expect(get: "/profiles/jsmith").to route_to(
:controller => "profiles",
:action => "show",
:username => "jsmith"
)
end
it "does not expose a list of profiles" do
expect(:get => "/profiles").not_to be_routable
end
end
### Helpers
# spec/helpers/*
describe EventsHelper do
describe "#link_to_event" do
it "displays the title, and formatted date" do
event = Event.new("Ruby Kaigi", Date.new(2010, 8, 27))
# helper is an instance of ActionView::Base configured with the
# EventsHelper and all of Rails' built-in helpers
expect(helper.link_to_event).to match /Ruby Kaigi, 27 Aug, 2010/
end
end
end

View File

@ -8,3 +8,6 @@ in config/environments/development.rb:
# Source maps for Sass
config.sass.debug_info = true
config.sass.line_comments = false
# Don't break apart
config.assets.debug = false

13
regexp.md Normal file
View File

@ -0,0 +1,13 @@
---
title: Regexp
layout: default
---
(?P<named_match>...)
(?:invisible group)
(?!negative look-ahead)
(?=positive look-ahead)
(?<!negative look-behind)
(?<=positive look-behind)

7
resolutions.md Normal file
View File

@ -0,0 +1,7 @@
---
title: Resolutions
layout: default
---
* iPhone 4S: 640 x 960 [320 x 480]
* iPhone 5: 640 x 1136 [320 x 568]

View File

@ -4,3 +4,52 @@ layout: default
---
rsync --progress -avz --exclude '.Trashes' --exclude '.Spotlight-V100' --exclude '.fseventsd'
### Options
Transfer:
-z, --compress
-n, --dry-run
Display:
-q, --quiet
-v, --verbose
-h, --human-readable
--progress
-u, --update # skip files newer on dest
-c, --checksum # skip based on checksum, not mod-time & size
Backups:
-b, --backup # backup with suffix
--suffix=SUFFIX # default ~ without --backup-dir
--backup-dir=DIR
Include:
--exclude=PATTERN
--exclude-from=FILE
--include=PATTERN
--include-from=FILE
--files-from=FILE # read list of filenames from FILe
Archive:
-a, --archive # archive (-rlptgoD)
-r, --recursive
-l, --links # copy symlinks as links
-p, --perms # preserve permissions
-t, --times # preserve times
-g, --group # preserve group
-o, --owner # preserve owner
-D # --devices --specials
--delete # Delete extra files

12
simple_form.md Normal file
View File

@ -0,0 +1,12 @@
---
title: SimpleForm
layout: default
---
<%= f.input :email, required: false, autofocus: true %>
<%= f.input :password, required: false %>
<%= f.input :remember_me, as: :boolean %>
<%= f.button :submit, "Sign in" %>
simple_form_for @x,
wrapper: :small

183
spine.md Normal file
View File

@ -0,0 +1,183 @@
---
title: Spine
layout: default
vim: ft=python
---
## Models
class User extends Spine.Model
@configure "User", "name", "address"
fullName: ->
[@first, @last].join ' '
### JavaScript
// Subclassing
User = Spine.Model.sub()
### Class methods
.configure 'modelname', attributes...
# Inheritance
.include(Module)
.extend(Module)
.create(name: "John")
.count()
# Events
.on 'refresh change', (user) -> ...
.trigger 'event'
.change (user) -> ... # same as on('change')
.fetch (user) -> ... # same as on('fetch')
# JSON
.toJSON() # all records
.fromJSON(json) # from json string
.fromForm(el)
# Data
.records # Hash of instances
.attributes # array of attributes (from .configure)
# Convenience
.toString() #=> "User"
# Find by ID
.exists(1)
.find(1) # throws error
# Find by something
.select (u) u.name == 'bob'
.findByAttribute 'name', 'bob'
.findAllByAttribute 'name', 'bob'
.all()
.slice(6, 13) # cloned copies of instances
# Iterating
.each (user) ->
# Ends
.first()
.last()
# Deleting
.deleteAll()
.destroyAll()
.destroyAll({ ..options.. })
.destroy(2)
### Instance methods
user = new User();
user
.isNew()
.exists()
# Validation
.isValid()
.validate() # validate = (-> "Name required" unless @name)
.attributes() # hash of attr values
.eql(other) # equality check
# Update
.load(attrs)
.reload()
.fromForm(form)
.updateAttribute("name", "john")
.updateAttributes(name: "John")
# Event
.on 'event', -> ...
.trigger 'event'
# Retrieve
.toJSON()
# Persistence
.save()
.destroy()
.dup() # clone as unsaved
### Mixins
class User extends Spine.Model
@include MyModule
@extend MyModule
### Events
.on 'create'
.on 'update'
.on 'destory'
.on 'save' # create / update
.on 'change' # create / update / destroy
.on 'refresh'
.on 'error' # validation error
## Ajax
class User extends Spine.Model
@extend Spine.Model.Ajax
@url: '/users'
@url: -> '/users'
scope: '2013'
### Using
User.fetch()
user = new User()
user.url() #=> "/users"
user.url('bands') #=> "/users/bands"
user.scope = 'admin'
user.url() #=> "/admin/users"
### Host
Spine.Model.host = 'http://endpoint'
### Ajax mapping
read → GET /collection
create → POST /collection (201 created)
update → PUT /collection/id
destroy → DELETE /collection/id
### Associations
class Photo extends Spine.Model
@belongsTo 'album', 'Album' # window['Album']
@belongsTo 'album', 'models/album' # via require.js
class Album
@hasMany 'photos', 'models/photo'
album.photos().all()
album.photos().create(name: "Vacation")
album.photos().find(id)
photo = Photo.create(album: album)
photo.album()
photo.album_id
### See
* http://spinejs.com/api/index
* http://spinejs.com/api/models
* http://spinejs.com/docs/ajax
* http://spinejs.com/docs/relations

39
tabular.md Normal file
View File

@ -0,0 +1,39 @@
---
title: Tabular
layout: default
---
### Examples
:Tab /,
hello , there
hi , you
:Tab /,/r0
hello,there
hi, you
:Tab /,/r1c1l0
# the separator counts as a column
# [r]ight align, [1] space, [c]enter align the comma, [1] space,
# [l]eft align, [0] spaces
hello , etc
hi , etc
`:Tab /^[^,]*\zs,/r0`
abc,hello
c,hi there
a,yo
### Specifiers
l|r|cN # left-right-center, with N spaces padding (l0)
r1c1l0 # multiple specifiers (one per column)
# the separator counts as a column

View File

@ -14,3 +14,6 @@ layout: default
### Apt archives path
/var/cache/apt/archives
### List services
service --status-all

View File

@ -1,21 +1,82 @@
• \u2022
· \u00b7
┄ \u2504
— \u2014 (mdash)
\u2013 (ndash)
◦ \u25e6 circle
✈' \u2708 airplane
❄ \u2744 snowflake
⚑ \u2691 flag
☯ \u262f yinyang
♞ \u265e horse
☀ \u2600 rays
× times
★ star
☆ star2
⚐ \u2690 flag
⚑ \u2691 flag
✓ \u2713 check
✕ \u2715
✗ \u2717 x mark
✘ \u2718 x mark bold
❏ \u274f checkbox
Spinners:
◜◠◝◞◡◟
❘❙❚
Triangles:
▲▼▶
⬅⬆⬇
⬅ \u2b05
⬆ \u2b06
⬇ \u2b07
◢ ◣ ◤ ◥
: «» XOR , (), [], •, ⌘, ⌥, ▲▼, ▸▹, ◇ XOR ◆, ◐◑◒◓ ◢ ◣ ◤ ◥, ★ ☆ , ♠♥♣♦, ⚐⚑, ✂
«
»
▸ \u25b8
◇ \u25c7
ࣾ home &#002302;
information &#008505;
♡ heart &#009825;
⚙ cog or gear &#009881;
⚿ key &#009919;
✉ envelope &#009993;
✎ pencil &#009998;
✓ check or tick mark &#010003;
❌ cross mark &#010060;
💬 speech balloon &#128172;
✈'
✂ scissors
information &#008505;
♡ heart &#009825;
⚙ cog or gear &#009881;
✉ envelope &#009993;
✎ pencil &#009998;
✓ check or tick mark &#010003;
"x".charCodeAt(0)
"x".charCodeAt(0).toString(16)
http://www.danshort.com/HTMLentities/index.php?w=dingb

View File

@ -27,6 +27,6 @@ To stop, use one of the following:
$ vagrant ssh # then: sudo shutdown -h now
$ vagrant suspend
$ vagrant destroy
$ vagrant destroy # !!

115
vagrantfile.md Normal file
View File

@ -0,0 +1,115 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
# config.vm.box_url = "http://domain.com/path/to/above.box"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network :forwarded_port, guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network :private_network, ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.
# Enable provisioning with Puppet stand alone. Puppet manifests
# are contained in a directory path relative to this Vagrantfile.
# You will need to create the manifests directory and a manifest in
# the file precise64.pp in the manifests_path directory.
#
# An example Puppet manifest to provision the message of the day:
#
# # group { "puppet":
# # ensure => "present",
# # }
# #
# # File { owner => 0, group => 0, mode => 0644 }
# #
# # file { '/etc/motd':
# # content => "Welcome to your Vagrant-built virtual machine!
# # Managed by Puppet.\n"
# # }
#
# config.vm.provision :puppet do |puppet|
# puppet.manifests_path = "manifests"
# puppet.manifest_file = "init.pp"
# end
# Enable provisioning with chef solo, specifying a cookbooks path, roles
# path, and data_bags path (all relative to this Vagrantfile), and adding
# some recipes and/or roles.
#
# config.vm.provision :chef_solo do |chef|
# chef.cookbooks_path = "../my-recipes/cookbooks"
# chef.roles_path = "../my-recipes/roles"
# chef.data_bags_path = "../my-recipes/data_bags"
# chef.add_recipe "mysql"
# chef.add_role "web"
#
# # You may also specify custom JSON attributes:
# chef.json = { :mysql_password => "foo" }
# end
# Enable provisioning with chef server, specifying the chef server URL,
# and the path to the validation key (relative to this Vagrantfile).
#
# The Opscode Platform uses HTTPS. Substitute your organization for
# ORGNAME in the URL and validation key.
#
# If you have your own Chef Server, use the appropriate URL, which may be
# HTTP instead of HTTPS depending on your configuration. Also change the
# validation key to validation.pem.
#
# config.vm.provision :chef_client do |chef|
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
# chef.validation_key_path = "ORGNAME-validator.pem"
# end
#
# If you're using the Opscode platform, your validator client is
# ORGNAME-validator, replacing ORGNAME with your organization name.
#
# If you have your own Chef Server, the default validation client name is
# chef-validator, unless you changed the configuration.
#
# chef.validation_client_name = "ORGNAME-validator"
end

24
vim.md
View File

@ -28,6 +28,12 @@ Motions
a[ ( { < # A [], (), or {} block
a' " ` # A quoted string
[( [{ [< # previous ( or { or <
]) # next
[m # previous method start
[M # previous method end
Example:
yip # Yank inner paragraph
@ -118,3 +124,21 @@ Marks
syn region inBold concealends matchgroup=bTag start="<b>" end="</b>"
hi inBold gui=bold
hi bTag guifg=blue
### Syntax
syn match :name ":regex" :flags
syn region Comment start="/\*" end="\*/"
syn region String start=+"+ end=+"+ skip=+\\"+
syn cluster :name contains=:n1,:n2,:n3...
flags:
keepend
oneline
nextgroup=
contains=
contained
hi def link markdownH1 htmlH1

16
yaml.md Normal file
View File

@ -0,0 +1,16 @@
---
title: Yaml
layout: default
---
Multiline: |
hello
world
Inheritance: &defaults
a: 2
b: 3
Inherit:
<<: *defaults
b: 4