Massive update.
This commit is contained in:
parent
fe1d99347c
commit
baca60b2ee
7
bash.md
7
bash.md
|
@ -1,6 +1,11 @@
|
||||||
title: Bash
|
title: Bash
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Clever one liners
|
||||||
|
|
||||||
|
# Search and replace in all files
|
||||||
|
perl -p -i -e "s/from/to/g" **/*.css
|
||||||
|
|
||||||
### String substitutions by patterns
|
### String substitutions by patterns
|
||||||
|
|
||||||
STR=/path/to/foo.c
|
STR=/path/to/foo.c
|
||||||
|
@ -31,7 +36,7 @@ title: Bash
|
||||||
|
|
||||||
for i in /etc/rc.*; do
|
for i in /etc/rc.*; do
|
||||||
echo $i
|
echo $i
|
||||||
end
|
done
|
||||||
|
|
||||||
### Reading input
|
### Reading input
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
### Getting the context
|
||||||
|
|
||||||
|
var canvas = document.getElementById('c');
|
||||||
|
var c = canvas.getContext("2d");
|
||||||
|
|
||||||
|
### Basic drawing
|
||||||
|
|
||||||
|
// x = 10, y = 20, width = 200, height = 100
|
||||||
|
c.fillStyle = '#ff0000';
|
||||||
|
c.strokeStyle = '#ff00ff';
|
||||||
|
c.lineWidth = 5;
|
||||||
|
c.lineCap = 'round';
|
||||||
|
c.fillRect(10, 20, 200, 100);
|
||||||
|
c.stroke();
|
||||||
|
|
||||||
|
### Image drawing
|
||||||
|
|
||||||
|
c.drawImage(image, dx, dy, [dw, dh]);
|
||||||
|
/* `image` can be HTML Image/Canvas/Video */
|
||||||
|
|
||||||
|
### Colors, styles shadows
|
||||||
|
|
||||||
|
c.strokeStyle = '#ff00ff';
|
||||||
|
c.fillStyle = '#ff00ff';
|
||||||
|
|
||||||
|
c.shadowOffsetX = 0;
|
||||||
|
c.shadowOffsetY = 0;
|
||||||
|
c.shadowOffsetBlur = 3.0;
|
||||||
|
c.shadowColor = 'rgba(0,0,0,0.2)';
|
||||||
|
|
||||||
|
### Gradients
|
||||||
|
|
||||||
|
gr = c.createLinearGgadient(x0,y0,x1,y1)
|
||||||
|
gr = c.createRadialGradient(x0,y0,r0,x1,y1,r1)
|
||||||
|
pat = c.createPattern(image, 'repeat-x')
|
||||||
|
|
||||||
|
c.fillStyle = gr
|
||||||
|
|
||||||
|
### Drawing
|
||||||
|
|
||||||
|
c.beginPath()
|
||||||
|
c.moveTo(x,y)
|
||||||
|
c.lineTo(x,y)
|
||||||
|
c.quadraticCurveTo(cpx,cpy,x,y)
|
||||||
|
c.bezierCurveTo(cp1x,cp1y,cp2x,cp2y)
|
||||||
|
c.arcTo(...)
|
||||||
|
c.arc(...)
|
||||||
|
c.closePath()
|
||||||
|
|
||||||
|
### Text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Resources
|
||||||
|
|
||||||
|
* [Canvas Cheatsheet PDF][cc]
|
||||||
|
[cc]: http://www.nihilogic.dk/labs/canvas_sheet/HTML5_Canvas_Cheat_Sheet.pdf
|
||||||
|
|
39
css.md
39
css.md
|
@ -7,7 +7,10 @@ Webkit extensions
|
||||||
### Font smoothing
|
### Font smoothing
|
||||||
|
|
||||||
/* maxvoltar.com/archive/-webkit-font-smoothing */
|
/* maxvoltar.com/archive/-webkit-font-smoothing */
|
||||||
html { -webkit-font-smoothing: antialiased; }
|
* {
|
||||||
|
text-rendering: optimizeLegibility !important;
|
||||||
|
-webkit-font-smoothing: antialiased !important;
|
||||||
|
}
|
||||||
|
|
||||||
### Heading kerning pairs and ligature
|
### Heading kerning pairs and ligature
|
||||||
|
|
||||||
|
@ -28,3 +31,37 @@ Webkit extensions
|
||||||
|
|
||||||
/* http://www.webkit.org/blog/85/introducing-text-stroke/ */
|
/* http://www.webkit.org/blog/85/introducing-text-stroke/ */
|
||||||
-webkit-text-stroke: 3px black;
|
-webkit-text-stroke: 3px black;
|
||||||
|
|
||||||
|
### iOS Scrolling prevention
|
||||||
|
|
||||||
|
document.ontouchstart = (e) ->
|
||||||
|
$pane = $(e.target).closest('.scrollable>div')
|
||||||
|
if $pane.length is 0 or $pane[0].scrollHeight <= $pane.innerHeight()
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
|
%ios-scrollable
|
||||||
|
&, >div
|
||||||
|
-webkit-overflow-scrolling: touch
|
||||||
|
overflow: auto
|
||||||
|
|
||||||
|
>div
|
||||||
|
position: absolute
|
||||||
|
top: 0
|
||||||
|
left: 0
|
||||||
|
right: 0
|
||||||
|
bottom: 0
|
||||||
|
|
||||||
|
### UIWebView optimizations
|
||||||
|
|
||||||
|
/* http://www.bitsandpix.com/entry/ios-webkit-uiwebview-remove-tapclick-highlightborder-with-css/ */
|
||||||
|
|
||||||
|
* {
|
||||||
|
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||||
|
-webkit-user-select: none; /* disable text select */
|
||||||
|
-webkit-touch-callout: none; /* disable callout, image save panel (popup) */
|
||||||
|
-webkit-tap-highlight-color: transparent; /* "turn off" link highlight */
|
||||||
|
}
|
||||||
|
|
||||||
|
a:focus {
|
||||||
|
outline:0; // Firefox (remove border on link click)
|
||||||
|
}
|
||||||
|
|
10
fitness.md
10
fitness.md
|
@ -44,3 +44,13 @@ Jennifer Thompson video: http://www.youtube.com/watch?v=34XRmd3a8_0
|
||||||
intense exercise (>70% VO2 max) primarily utilized carbohydrate.
|
intense exercise (>70% VO2 max) primarily utilized carbohydrate.
|
||||||
|
|
||||||
http://www.exrx.net/Nutrition/Substrates.html
|
http://www.exrx.net/Nutrition/Substrates.html
|
||||||
|
|
||||||
|
### Deloads on a cut
|
||||||
|
|
||||||
|
- "I would never recommend traditional style deloads on a cut, regardless of
|
||||||
|
training regimen."
|
||||||
|
|
||||||
|
- "increase the rest day interval between sessions"
|
||||||
|
|
||||||
|
https://www.facebook.com/permalink.php?story_fbid=273265046115238&id=116211138487297&comment_id=1262284&offset=0&total_comments=34
|
||||||
|
|
||||||
|
|
5
html.md
5
html.md
|
@ -9,6 +9,11 @@ title: HTML
|
||||||
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
|
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
|
||||||
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
|
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
|
||||||
|
|
||||||
|
### IE conditionals
|
||||||
|
|
||||||
|
<!--[if IE]> I'm IE <![endif]-->
|
||||||
|
<!--[if !IE]> --> Not IE <!-- <![endif]-->
|
||||||
|
|
||||||
### iPhone viewport
|
### iPhone viewport
|
||||||
|
|
||||||
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
|
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
## Web workers
|
||||||
|
|
||||||
|
// Client code
|
||||||
|
|
||||||
|
var worker = new Worker('worker.js');
|
||||||
|
worker.onmessage = function(message) {
|
||||||
|
alert(message.data);
|
||||||
|
});
|
||||||
|
worker.postMessage("");
|
||||||
|
|
||||||
|
### Worker code
|
||||||
|
|
||||||
|
// worker.js
|
||||||
|
|
||||||
|
self.onmessage = function(message) {
|
||||||
|
alert(message.data);
|
||||||
|
}
|
||||||
|
self.postMessage("");
|
||||||
|
|
||||||
|
### Message data
|
||||||
|
|
||||||
|
// [MessageEvent]
|
||||||
|
bubbles: false
|
||||||
|
cancelBubble: false
|
||||||
|
cancelable: false
|
||||||
|
clipboardData: undefined
|
||||||
|
currentTarget: Worker
|
||||||
|
data: "Hello"
|
||||||
|
defaultPrevented: false
|
||||||
|
eventPhase: 0
|
||||||
|
lastEventId: ""
|
||||||
|
origin: ""
|
||||||
|
ports: Array[0]
|
||||||
|
returnValue: true
|
||||||
|
source: null
|
||||||
|
srcElement: Worker
|
||||||
|
target: Worker
|
||||||
|
timeStamp: 1344821022383
|
||||||
|
type: "message"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
5
linux.md
5
linux.md
|
@ -2,3 +2,8 @@
|
||||||
|
|
||||||
$ mount -t tmpfs -o size=5G,nr_inodes=5k,mode=700 tmpfs /tmp
|
$ mount -t tmpfs -o size=5G,nr_inodes=5k,mode=700 tmpfs /tmp
|
||||||
|
|
||||||
|
### Visudo
|
||||||
|
|
||||||
|
sudo visudo
|
||||||
|
|
||||||
|
username ALL=(ALL) NOPASSWD:/sbin/restart whatever
|
||||||
|
|
41
makefile.md
41
makefile.md
|
@ -1,17 +1,53 @@
|
||||||
### Safe assignment
|
### Var assignment
|
||||||
|
|
||||||
|
JS_COMPRESSOR := $(uglify)
|
||||||
|
|
||||||
|
# Safe assignment
|
||||||
prefix ?= /usr/local
|
prefix ?= /usr/local
|
||||||
|
|
||||||
|
### Magic variables
|
||||||
|
|
||||||
|
$^ -- dependencies
|
||||||
|
$@ -- the thing to be built
|
||||||
|
|
||||||
|
$@ -- Rule target
|
||||||
|
$% -- Target member name ('foo' in 'foo.c' for '%.c')
|
||||||
|
$^ -- Prerequisites (all, without duplication)
|
||||||
|
$+ -- Prerequisites (all, with duplication)
|
||||||
|
$? -- Prerequisites (new ones)
|
||||||
|
$| -- Prerequisites (order-only?)
|
||||||
|
$< -- Prerequisite (first)
|
||||||
|
$* -- Basename without extension of the target (?)
|
||||||
|
|
||||||
### Cool stuff
|
### Cool stuff
|
||||||
|
|
||||||
gitdir ?= $(shell git --exec-path)
|
gitdir ?= $(shell git --exec-path)
|
||||||
gitver ?= $(word 3,$(shell git --version))
|
gitver ?= $(word 3,$(shell git --version))
|
||||||
|
|
||||||
|
### Find files
|
||||||
|
|
||||||
|
FILES = $(shell find images -name "*")
|
||||||
|
|
||||||
|
$(patsubst images/%, assets/%, $(shell find images -name "*"))
|
||||||
|
|
||||||
### Substitutions
|
### Substitutions
|
||||||
|
|
||||||
|
# Same
|
||||||
$(SOURCE:.cpp=.o)
|
$(SOURCE:.cpp=.o)
|
||||||
$(patsubst %.cpp, %.c, $(SOURCES))
|
$(patsubst %.cpp, %.c, $(SOURCES))
|
||||||
|
|
||||||
|
$(strip $(string_var))
|
||||||
|
|
||||||
|
$(filter %.less, $(files))
|
||||||
|
$(filter-out %.less, $(files))
|
||||||
|
|
||||||
|
### Executing
|
||||||
|
|
||||||
|
JS_COMPRESSOR := $(uglify)
|
||||||
|
|
||||||
|
docs:
|
||||||
|
$(JS_COMPRESSOR) file.js
|
||||||
|
|
||||||
### Building files
|
### Building files
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
|
@ -22,5 +58,4 @@
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@echo "hello."
|
@echo "hello."
|
||||||
@false
|
@false
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
* Show tables: `\dt`
|
||||||
|
* Show databases: `\l`
|
||||||
|
* Show columns of a table: `\d table` or `\d+ table`
|
|
@ -0,0 +1,77 @@
|
||||||
|
title: Rails helpers
|
||||||
|
---
|
||||||
|
|
||||||
|
### Date helpers
|
||||||
|
|
||||||
|
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html
|
||||||
|
|
||||||
|
### Date
|
||||||
|
|
||||||
|
distance_of_time_in_words(Time.now, project.end_date) #=> 3 hours
|
||||||
|
distance_of_time_in_words_to_now project.end_date #=> 3 hours
|
||||||
|
|
||||||
|
### Time select
|
||||||
|
|
||||||
|
# Creates a time select tag that, when POSTed, will be stored in the article
|
||||||
|
# variable in the sunrise attribute.
|
||||||
|
time_select "article", "start_time"
|
||||||
|
|
||||||
|
# All options are optional
|
||||||
|
time_select "article", "start_time", \
|
||||||
|
:include_seconds => true,
|
||||||
|
:minute_step => 15,
|
||||||
|
:prompt => true,
|
||||||
|
:prompt => { :hour => "Choose hr", :minute => "Choose min", :second => "Choose sec" },
|
||||||
|
:ampm => true
|
||||||
|
|
||||||
|
# For dates (all options are optional)
|
||||||
|
date_select "article", "written_on", \
|
||||||
|
:start_year => 1995,
|
||||||
|
:use_month_numbers => true,
|
||||||
|
:discard_day => true,
|
||||||
|
:include_blank => true,
|
||||||
|
:order => [:day, :month, :year],
|
||||||
|
:default => 3.days.from_now,
|
||||||
|
:default => { :day => 20 },
|
||||||
|
:prompt => { :day => 'Select day', :month => 'Select month', :year => 'Select year' }
|
||||||
|
|
||||||
|
### Time tag
|
||||||
|
|
||||||
|
time_tag Date.today #=> <time datetime="2010-11-04">November 04, 2010<%rtime>
|
||||||
|
time_tag Time.now #=> <time datetime="2010-11-04T17:55:45+01:00">November 04, 2010 17:55</time>
|
||||||
|
|
||||||
|
time_tag Date.yesterday, 'Yesterday' #=> <time datetime="2010-11-03">Yesterday<%rtime>
|
||||||
|
time_tag Date.today, :pubdate => true #=> <time datetime="2010-11-04" pubdate="pubdate">November 04, 2010</time>
|
||||||
|
|
||||||
|
## Forms
|
||||||
|
|
||||||
|
### Forms
|
||||||
|
|
||||||
|
= form_for @post do |f|
|
||||||
|
|
||||||
|
### Fields
|
||||||
|
|
||||||
|
f.check_box :enabled
|
||||||
|
f.text_field :title
|
||||||
|
f.text_area :body, \
|
||||||
|
:size => '60x12'
|
||||||
|
|
||||||
|
### Select dropdowns
|
||||||
|
|
||||||
|
f.time_zone_select :time_zone
|
||||||
|
f.date_select :birthday
|
||||||
|
|
||||||
|
f.select :city_id, [['Lisbon',1], ['Madrid',2], ...], 4 # (4 = selected)
|
||||||
|
|
||||||
|
f.collection_select :city_id, City.all, :id, :name
|
||||||
|
|
||||||
|
options_for_select [['Lisbon',1], ['Madrid', 2], ...], 4 # Just makes <option> tags
|
||||||
|
|
||||||
|
### The rest
|
||||||
|
|
||||||
|
f.submit "Create"
|
||||||
|
|
||||||
|
### Files
|
||||||
|
|
||||||
|
= form_for @post, :multipart => true do |f|
|
||||||
|
= f.file_field :picture
|
|
@ -1,6 +1,11 @@
|
||||||
title: Rails migrations
|
title: Rails migrations
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
### Automatically make migrations
|
||||||
|
|
||||||
|
$ rails generate migration RemovePartNumberFromProducts part_number:string
|
||||||
|
$ rails generate migration AddNameToWidgets name:string
|
||||||
|
|
||||||
### Run migrations
|
### Run migrations
|
||||||
|
|
||||||
$ rake db:migrate
|
$ rake db:migrate
|
||||||
|
|
|
@ -106,16 +106,24 @@ Validation
|
||||||
|
|
||||||
class Person < ActiveRecord::Base
|
class Person < ActiveRecord::Base
|
||||||
|
|
||||||
|
# Non empty
|
||||||
|
validates :name, :presence => true
|
||||||
|
|
||||||
# Checkboxes
|
# Checkboxes
|
||||||
validates :terms_of_service, :acceptance => true
|
validates :terms_of_service, :acceptance => true
|
||||||
|
|
||||||
# Validate associated records
|
# Validate the associated records to ensure they're valid as well
|
||||||
has_many :books
|
has_many :books
|
||||||
validates_associated :books
|
validates_associated :books
|
||||||
|
|
||||||
# Confirmation (like passwords)
|
# Confirmation (like passwords)
|
||||||
validates :email, :confirmation => true
|
validates :email, :confirmation => true
|
||||||
|
|
||||||
|
# Unique
|
||||||
|
validates :slug, :uniqueness => true
|
||||||
|
validates :slug, :uniqueness => { :case_sensitive => false }
|
||||||
|
validates :holiday, :uniqueness => { :scope => :year, :message => "only once a year" }
|
||||||
|
|
||||||
# Format
|
# Format
|
||||||
validates :legacy_code, :format => {
|
validates :legacy_code, :format => {
|
||||||
:with => /\A[a-zA-Z]+\z/,
|
:with => /\A[a-zA-Z]+\z/,
|
||||||
|
@ -142,11 +150,15 @@ Validation
|
||||||
validates :points, :numericality => true
|
validates :points, :numericality => true
|
||||||
validates :games_played, :numericality => { :only_integer => true }
|
validates :games_played, :numericality => { :only_integer => true }
|
||||||
|
|
||||||
# Non empty
|
|
||||||
validates :name, :presence => true
|
|
||||||
|
|
||||||
# Multiple
|
# Multiple
|
||||||
validate :login, :email, :presence => true
|
validates :login, :email, :presence => true
|
||||||
|
|
||||||
|
# Conditional
|
||||||
|
validates :description, :presence => true, :if => :published?
|
||||||
|
validates :description, :presence => true, :if => lambda { |obj| .. }
|
||||||
|
|
||||||
|
# On
|
||||||
|
validates :title, :presence => true, :on => :save # :save | :create | :update
|
||||||
end
|
end
|
||||||
|
|
||||||
### Custom validations
|
### Custom validations
|
||||||
|
@ -158,7 +170,7 @@ Validation
|
||||||
errors.add(:foo, 'cant be nil') if foo.nil?
|
errors.add(:foo, 'cant be nil') if foo.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
API
|
API
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
28
sass.md
28
sass.md
|
@ -1,6 +1,24 @@
|
||||||
|
### Compass: Sprites
|
||||||
|
|
||||||
### Sprites
|
@import compass/utilities/sprites
|
||||||
|
|
||||||
|
$sprites: sprite-map('sprites/*.png')
|
||||||
|
$sprites: sprite-map('sprites/*.png', $spacing: 20px)
|
||||||
|
|
||||||
|
@mixin sprite($name)
|
||||||
|
background-image: sprite-url($sprite)
|
||||||
|
|
||||||
|
+sprite-dimensions($sprite, $name)
|
||||||
|
width: image-width(sprite-file($sprite, $name)
|
||||||
|
height: image-height(sprite-file($sprite, $name)
|
||||||
|
|
||||||
|
+sprite-background-position($sprite, $name[, $offset-x, $offset-y])
|
||||||
|
background-position: sprite-position($sprite, $name)
|
||||||
|
nth(sprite-position($sprite, $name), 1) # X position
|
||||||
|
nth(sprite-position($sprite, $name), 2) # Y position
|
||||||
|
|
||||||
|
|
||||||
|
### Compass: Sprites (the @import way)
|
||||||
|
|
||||||
// Sprite sets (applies to icon/*.png)
|
// Sprite sets (applies to icon/*.png)
|
||||||
$icon-spacing: 0
|
$icon-spacing: 0
|
||||||
|
@ -33,3 +51,11 @@
|
||||||
background: sprite($icon-sprites, refresh, -2px, -9px)
|
background: sprite($icon-sprites, refresh, -2px, -9px)
|
||||||
//background: url(...) -2px -19px;
|
//background: url(...) -2px -19px;
|
||||||
|
|
||||||
|
|
||||||
|
### Loopo
|
||||||
|
|
||||||
|
$i: 6;
|
||||||
|
@while $i > 0 {
|
||||||
|
.item-#{$i} { width: 2em * $i; }
|
||||||
|
$i: $i - 2;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
title: Stylus
|
||||||
|
----
|
||||||
|
|
||||||
|
### Variables
|
||||||
|
|
||||||
|
royal-blue = #36a
|
||||||
|
support-for-ie ?= true
|
||||||
|
|
||||||
|
div
|
||||||
|
color: royal-blue
|
||||||
|
|
||||||
|
### Mixin without args
|
||||||
|
|
||||||
|
red-border()
|
||||||
|
border: solid 2px red
|
||||||
|
|
||||||
|
div
|
||||||
|
red-border()
|
||||||
|
|
||||||
|
### Mixin with arguments
|
||||||
|
|
||||||
|
border-radius(n)
|
||||||
|
-webkit-border-radius: n
|
||||||
|
border-radius: n
|
||||||
|
|
||||||
|
div
|
||||||
|
border-radius: 2px
|
||||||
|
|
||||||
|
Or with defaults:
|
||||||
|
|
||||||
|
border-radius(n=2px)
|
||||||
|
-webkit-border-radius: n
|
||||||
|
|
||||||
|
Multiple args:
|
||||||
|
|
||||||
|
xy(left, top)
|
||||||
|
left: left
|
||||||
|
top: top
|
||||||
|
|
||||||
|
div
|
||||||
|
xy: 2px 2px
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
|
||||||
|
add(a, b)
|
||||||
|
a + b
|
||||||
|
|
||||||
|
body
|
||||||
|
padding: add(10px, 5)
|
||||||
|
|
||||||
|
### Interpolation
|
||||||
|
|
||||||
|
-{prefix}-border-radius: 2px
|
||||||
|
|
||||||
|
### Built-in functions
|
||||||
|
|
||||||
|
alpha(#fff) //=> 1
|
||||||
|
alpha(rgba(0, 0, 0, 0.2)) //=> 0.2
|
||||||
|
|
||||||
|
dark(black) //=> true
|
||||||
|
light(black) //=> false
|
||||||
|
|
||||||
|
lighten(color, 10%)
|
||||||
|
darken(color, 10%)
|
||||||
|
saturate(color, 10%)
|
||||||
|
invert(color)
|
||||||
|
|
||||||
|
width: image-size(img)[0]
|
||||||
|
height: image-size(img)[1]
|
||||||
|
|
||||||
|
unquote(string)
|
||||||
|
|
||||||
|
s("rgba(0, 0, 0, %s)", 0.3) // Works like eval?
|
||||||
|
|
||||||
|
Add Property:
|
||||||
|
|
||||||
|
gradient(color)
|
||||||
|
add-property('background-image', linear-gradient(top, color, darken(color, 20%)))
|
||||||
|
color
|
||||||
|
|
||||||
|
body
|
||||||
|
background: gradient(red)
|
2
tig.md
2
tig.md
|
@ -31,6 +31,8 @@ Tig shortcuts
|
||||||
! # Revert file or chunk
|
! # Revert file or chunk
|
||||||
C # Commit
|
C # Commit
|
||||||
M # Merge
|
M # Merge
|
||||||
|
1 # Stage line
|
||||||
|
[] # Increase/decrease the diff context
|
||||||
|
|
||||||
### `H` - Branch view
|
### `H` - Branch view
|
||||||
|
|
||||||
|
|
24
vim.md
24
vim.md
|
@ -3,7 +3,10 @@ title: vim
|
||||||
|
|
||||||
. - repeat last command
|
. - repeat last command
|
||||||
]p - paste under the current indentation level
|
]p - paste under the current indentation level
|
||||||
|
|
||||||
`. - Go to last edit
|
`. - Go to last edit
|
||||||
|
`` - Go to last jump
|
||||||
|
|
||||||
C-o - Go back to previous location (C-i forward)
|
C-o - Go back to previous location (C-i forward)
|
||||||
C-t - Go back to last tag
|
C-t - Go back to last tag
|
||||||
|
|
||||||
|
@ -22,9 +25,9 @@ Motions
|
||||||
ap - a paragraph
|
ap - a paragraph
|
||||||
ip - inner paragraph
|
ip - inner paragraph
|
||||||
|
|
||||||
{a,i}p - Paragraph
|
ap, ip - Paragraph
|
||||||
{a,i}w - Word
|
aw, iw - Word
|
||||||
{a,i}s - Sentence
|
as, is - Sentence
|
||||||
|
|
||||||
ab - A block [(
|
ab - A block [(
|
||||||
aB - A block in [{
|
aB - A block in [{
|
||||||
|
@ -32,13 +35,22 @@ Motions
|
||||||
a[ ( { < - A [], (), or {} block
|
a[ ( { < - A [], (), or {} block
|
||||||
a' " ` - A quoted string
|
a' " ` - A quoted string
|
||||||
|
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
yip - Yank inner paragraph
|
yip - Yank inner paragraph
|
||||||
yap - Yank paragraph (including newline)
|
yap - Yank paragraph (including newline)
|
||||||
|
|
||||||
SCSS!
|
Tags
|
||||||
-----
|
----
|
||||||
|
|
||||||
|
^] - Jump to definition
|
||||||
|
g] - See all definitions
|
||||||
|
^O ^I - Back/forward
|
||||||
|
|
||||||
|
:tselect Classname - Find definitions of Classname
|
||||||
|
:tjump Classname - Find definitions of Classname (auto-select 1st)
|
||||||
|
:tag Classname - Jump to first definition of Classname
|
||||||
|
|
||||||
|
## My own customizations
|
||||||
|
|
||||||
va{= - reindent block
|
va{= - reindent block
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
title: Vows
|
||||||
|
---
|
||||||
|
|
||||||
|
### Vows
|
||||||
|
|
||||||
|
* [Vowsjs.org](http://vowsjs.org/)
|
||||||
|
|
||||||
|
### CoffeeScript usage
|
||||||
|
|
||||||
|
vows = require "vows"
|
||||||
|
assert = require "assert"
|
||||||
|
|
||||||
|
vows
|
||||||
|
.describe('My tests')
|
||||||
|
.addBatch
|
||||||
|
'context':
|
||||||
|
topic: ->
|
||||||
|
100
|
||||||
|
'should work': (number) ->
|
||||||
|
assert.equal number, 100
|
||||||
|
|
||||||
|
.export(module)
|
||||||
|
|
||||||
|
### Running
|
||||||
|
|
||||||
|
vows test/*-test.* --spec
|
||||||
|
|
||||||
|
### Assertions
|
||||||
|
|
||||||
|
assert.equal a, b
|
||||||
|
assert.notEqual a, b
|
||||||
|
assert.strictEqual a, b
|
||||||
|
|
||||||
|
assert.isNaN(number)
|
||||||
|
assert.instanceOf(object, klass)
|
||||||
|
assert.isUndefined(object)
|
||||||
|
assert.isFunction(func)
|
||||||
|
assert.isNull(object)
|
||||||
|
assert.isNotZero(object)
|
||||||
|
assert.isObject(object)
|
||||||
|
assert.isString(object)
|
||||||
|
|
||||||
|
### Async
|
||||||
|
|
||||||
|
.addBatch
|
||||||
|
topic: ->
|
||||||
|
doStuff()
|
||||||
|
@callback 2
|
||||||
|
'check things': (n) ->
|
||||||
|
assert.equal 2, n
|
Loading…
Reference in New Issue