This commit is contained in:
Rico Sta. Cruz 2013-01-25 05:04:38 +08:00
parent 54a2ab01bf
commit 317b6cc5a9
10 changed files with 250 additions and 13 deletions

View File

@ -109,7 +109,7 @@ Ifs
### Numeric comparisons ### Numeric comparisons
if $(( $a < $b )) if (( $a < $b ))
### Unset variables ### Unset variables
@ -131,13 +131,13 @@ Numeric calculations
Arrays Arrays
------ ------
# Declaring using declare -a
declare -a Fruits=('Apple' 'Banana' 'Orange')
Fruits[0]="Apple" Fruits[0]="Apple"
Fruits[1]="Banana" Fruits[1]="Banana"
Fruits[2]="Orange" Fruits[2]="Orange"
# Declaring using declare -a
declare -a Fruits=('Apple' 'Banana' 'Orange')
echo ${Fruits[0]} # Element #0 echo ${Fruits[0]} # Element #0
echo ${Fruits[@]} # All elements, space-separated echo ${Fruits[@]} # All elements, space-separated
echo ${#Fruits[@]} # Number of elements echo ${#Fruits[@]} # Number of elements

17
css.md
View File

@ -105,3 +105,20 @@ Webkit extensions
a:focus { a:focus {
outline:0; // Firefox (remove border on link click) outline:0; // Firefox (remove border on link click)
} }
Browser hacks
-------------
Not recommended, but here they are if you ever need them. Note that vendor
prefixes may go away eventually.
### Mozilla-only
@-moz-document url-prefix() {
.box { color: blue; }
}
### Webkit-only
@media all and (-webkit-min-device-pixel-ratio: 1) {
}

13
ec2.md
View File

@ -6,6 +6,19 @@ title: EC2 API tools
$ sudo apt-get install ec2-api-tools ec2-ami-tools $ sudo apt-get install ec2-api-tools ec2-ami-tools
$ brew install ec2-api-tools ec2-ami-tools $ brew install ec2-api-tools ec2-ami-tools
### Pem files
$ brew info ec2-api-tools
* Before you can use these tools you must export some variables to your $SHELL
and download your X.509 certificate and private key from Amazon Web Services.
* Your certificate and private key are available at
[aws-portal.amazon.com](http://aws-portal.amazon.com/gp/aws/developer/account/index.html?action=access-key).
* Download two `.pem` files, one starting with `pk-`, and one starting with `cert-`.
You need to put both into a folder in your home directory, `~/.ec2`.
### Key pair ### Key pair
# To use public images (AMI's), you need an SSH keypair from EC2. # To use public images (AMI's), you need an SSH keypair from EC2.

133
firefox.md Normal file
View File

@ -0,0 +1,133 @@
title: Firefox
----
### Firefox 18 (Jan 2013)
* Faster JS compiler (IonMonkey)
* Mac retina support
* JS `window.devicePixelRatio`
* JS unprefixed `ontouchstart`
### Firefox 17 (Nov 2012)
* No more support for Mac OSX 10.5 and below
* SVG `FillPaint` and `StrokePaint`
* HTML `<iframe sandbox=...>` ([docs][iframe-sandbox])
[iframe-sandbox]: https://developer.mozilla.org/en-US/docs/HTML/Element/iframe#attr-sandbox
### Firefox 16 (Oct 2012)
* Web app support ([docs][webapp])
* Unprefixed CSS animations, transitions, transforms, gradients
[webapp]: https://developer.mozilla.org/en-US/docs/Apps/Getting_Started
### Firefox 15 (Aug 2012)
* Background updates
* SPDY v3
* Opus audio codec
* HTML `<audio played>` (and `<video>`)
* HTML `<source media=...>`
### Firefox 14 (Jul 2012)
* Full screen support for OSX Lion
* JS pointer lock API ([docs][lock])
* JS display sleep API ([docs][sleep])
[lock]: https://developer.mozilla.org/en-US/docs/API/Pointer_Lock_API
[sleep]: https://bugzilla.mozilla.org/show_bug.cgi?id=697132
### Firefox 13 (Jun 2012)
* Smooth scrolling by default
* SPDY on by default
* CSS `column-fill` ([docs][cf])
* ECMA 6 `Map` and `Set`
* CSS `background-position` extended syntax
* CSS `:invalid`
* CSS turn unit (`rotate(0.5turn)`)
[cf]: https://developer.mozilla.org/en/CSS/column-fill
### Firefox 12 (Apr 2012)
* CSS `text-align-last` ([docs][tal])
[tal]: https://developer.mozilla.org/en/CSS/text-align-last
### Firefox 11 (Mar 2012)
* `element.outerHTML` ([docs][outer])
* Dev tools: Style editor, 3D page inspector ([docs][tools])
* Unprefixed web sockets
* CSS `text-size-adjust` ([docs][tsa])
[outer]: https://developer.mozilla.org/en-US/docs/DOM/element.outerHTML
[tools]: https://hacks.mozilla.org/2011/12/new-developer-tools-in-firefox-11-aurora/
[tsa]: https://developer.mozilla.org/en-US/docs/CSS/text-size-adjust
### Firefox 10 (Jan 2012)
* CSS 3D transforms
* HTML `<bdi>` element
* JS fullscreen API ([docs][fs])
* IndexedDB APIs
* Dev tools: CSS Style inspector
[fs]: https://wiki.mozilla.org/Platform/Features/Full_Screen_APIs
### Firefox 9 (Dec 2011)
* Two-finger swipe in Mac OSX Lion
* CSS `font-stretch`
* CSS improved `text-overflow`
* JS `navigator.doNotTrack`
### Firefox 8 (Nov 2011)
### Firefox 7 (Sep 2011)
* CSS `text-overflow: ellipsis`
* Hidden `http://` prefix in address bar
### Firefox 6 (Aug 2011)
* JS `window.matchMedia`
* Websockets (!)
* JS EvetnSource / server-sent events
### Firefox 5 (Jun 2011)
* CSS animations
* Background tab `setTimeout` and `setInterval` clamped to 1000ms
### Firefox 4 (Mar 2011)
* Do Not Track (DNT) header
* New JS endinge (JagerMonkey)
* Hardware-accelerated rendering
* WebM video
* OpenType ligatures/kerning/font variants
* CSS transitions partial support
* JS audio data API
* JS `mozRequestAnimationFrame`
* HTML5 forms API
* `<video buffered>`
* HTML5 history API
* New HTML5 parser
* ...
### Firefox 3.6 (Jan 2010)
* CSS gradients
* CSS pointer events
* HTML drag & drop API
* HTML `<script async>`
### Reference
* [Firefox releases](https://www.mozilla.org/en-US/firefox/releases/)

View File

@ -55,3 +55,11 @@ http://www.exrx.net/Nutrition/Substrates.html
https://www.facebook.com/permalink.php?story_fbid=273265046115238&id=116211138487297&comment_id=1262284&offset=0&total_comments=34 https://www.facebook.com/permalink.php?story_fbid=273265046115238&id=116211138487297&comment_id=1262284&offset=0&total_comments=34
### Conditioning with 5/3/1
- "For conditioning, I highly recommend 30-40 minutes of walking every day.
Yes, walking. If youre asking why something so non-strenuous: if physique
goals are your only concern, do not let the conditioning take away from your
recovery."
Jim Wendler: http://www.jimwendler.com/2012/09/531-and-bodybuilding/

16
imagemagick.md Normal file
View File

@ -0,0 +1,16 @@
### Resize to fit
convert input.jpg -resize 80x80^ -gravity center -extent 80x80 icon.png
### Convert all images to another format
mogrify -format jpg -quality 85 *.png
### Make a pdf
convert *.jpg hello.pdf
### References
* http://www.noah.org/wiki/ImageMagick

37
minitest.md Normal file
View File

@ -0,0 +1,37 @@
title: Minitest
---
### Usage
require 'minitest/autorun'
describe "X" do
it "should work" do
assert true
end
end
### Specs
a.must_equal b
3.must_be_close_to 2.99999
collection.must_include needle
collection.must_be_empty
.must_be_kind_of
.must_match
a.must_be :<=, 42
obj.must_respond_to msg
a.must_be_same_as b
proc { ... }.must_output out_or_nil [, err]
proc { ... }.must_raise exception
proc { ... }.must_throw sym
Wont is the inverse of must:
a.must_equal b
a.wont_equal b

19
osx.md
View File

@ -1,19 +1,16 @@
Locations of startup items ### Locations of startup items
--------------------------
/System/Library/LaunchAgents/ /System/Library/LaunchAgents/
/System/Library/LaunchDaemons/ /System/Library/LaunchDaemons/
/Library/LaunchAgents/ /Library/LaunchAgents/
/Library/LaunchDaemons/ /Library/LaunchDaemons/
Hide desktop icons ### Hide desktop icons
------------------
defaults write com.apple.finder CreateDesktop -bool false defaults write com.apple.finder CreateDesktop -bool false
killall Finder killall Finder
Auto-hide other windows on dock switch ### Auto-hide other windows on dock switch
--------------------------------------
defaults write com.apple.dock single-app -bool TRUE defaults write com.apple.dock single-app -bool TRUE
killall Dock killall Dock
@ -21,8 +18,12 @@ Auto-hide other windows on dock switch
defaults delete com.apple.dock single-app defaults delete com.apple.dock single-app
killall Dock killall Dock
Flush DNS ### Flush DNS
---------
dscacheutil -flushcache killall -HUP mDNSResponder # 10.8+
dscacheutil -flushcache # 10.7 below
### Turn off spotlight
sudo vim /etc/hostconfig # change SPOTLIGHT=-YES- to SPOTLIGHT=-NO-
mdutil -i off /

View File

@ -2,3 +2,4 @@
* Show tables: `\dt` * Show tables: `\dt`
* Show databases: `\l` * Show databases: `\l`
* Show columns of a table: `\d table` or `\d+ table` * Show columns of a table: `\d table` or `\d+ table`

11
rails-features.md Normal file
View File

@ -0,0 +1,11 @@
### Caching
https://github.com/rails/actionpack-page_caching
class WeblogController < ActionController::Base
caches_page :show, :new
end
This will generate cache files such as weblog/show/5.html and weblog/new.html,
which match the URLs used that would normally trigger dynamic page
generation