Update Heroku.

This commit is contained in:
Rico Sta. Cruz 2014-07-15 21:35:11 +08:00
parent 4cc053d6c3
commit 8087cc36f8
7 changed files with 255 additions and 87 deletions

View File

@ -8,19 +8,20 @@ layout: default
768 992 1200 768 992 1200
' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '
<---------^------------^------------------^---------> <---------^------------^------------------^--------->
xs sm md lg xs sm md lg
(phone) (tablet) (laptop) (desktop)
Min: Min:
@media (min-width: @screen-sm-min) /* small >= 768px tablet */ @media (min-width: @screen-sm-min) { /* >= 768px (small tablet) */
@media (min-width: @screen-md-min) /* medium >= 992px desktop */ @media (min-width: @screen-md-min) { /* >= 992px (medium laptop) */
@media (min-width: @screen-lg-min) /* large >= 1200px big desktop */ @media (min-width: @screen-lg-min) { /* >= 1200px (large desktop) */
Max: Max:
@media (max-width: @screen-xs-max) /* xsmall < 768px phone */ @media (max-width: @screen-xs-max) { /* < 768px (xsmall phone) */
@media (max-width: @screen-sm-max) /* smalll < 992px tablet */ @media (max-width: @screen-sm-max) { /* < 992px (small tablet) */
@media (max-width: @screen-md-max) /* medium < 1200px desktop */ @media (max-width: @screen-md-max) { /* < 1200px (medium laptop) */
### Columns ### Columns

43
docker-osx.md Normal file
View File

@ -0,0 +1,43 @@
---
title: Docker on OSX
layout: default
---
You'll need these:
* [boot2docker] - bootstraps a Virtualbox VM to run a docker daemon
* [docker] - docker client
### Install
$ brew install boot2docker
$ brew install docker
$ boot2docker init
### Turning on
$ boot2docker up
Waiting for VM to be started...... Started.
To connect the Docker client to the Docker daemon, please set:
export DOCKER_HOST=tcp://192.168.59.103:2375
$ export DOCKER_HOST=tcp://192.168.59.103:2375
### Try it
$ docker search ubuntu
$ docker pull ubuntu
$ docker start ubuntu
### Turning off
$ boot2docker save
# save state to disk
### Vagrant
[boot2docker]: https://github.com/boot2docker/boot2docker
[docker]: https://www.docker.com/

View File

@ -3,11 +3,11 @@ title: Heroku
layout: default layout: default
--- ---
## `create` - Create an app ### `create` - Create an app
heroku create sushi heroku create sushi
## `sharing` - Collaboration ### `sharing` - Collaboration
# Manage collaborators # Manage collaborators
heroku sharing # List heroku sharing # List
@ -17,19 +17,19 @@ layout: default
# Transfer to another owner # Transfer to another owner
heroku sharing:transfer new@owner.com heroku sharing:transfer new@owner.com
## `logs` - Show logs ### `logs` - Show logs
heroku logs heroku logs
heroku logs -t # --tail (stream) heroku logs -t # --tail (stream)
heroku logs -s app # --source (only on app logs) heroku logs -s app # --source (only on app logs)
## `releases` ### `releases`
heroku releases heroku releases
heroku releases:info v25 heroku releases:info v25
heroku rollback heroku rollback
## `pg` - Postgresql ### `pg` - Postgresql
# Start a database # Start a database
heroku addons:add heroku-postgresql heroku addons:add heroku-postgresql
@ -38,18 +38,22 @@ layout: default
# Enable backups # Enable backups
heroku addons:add pgbackups:auto-month heroku addons:add pgbackups:auto-month
## `ps` - Managing processes ### `ps` - Managing processes
heroku ps # list heroku ps # list
heroku ps:scale web=1 # spawn more dynos heroku ps:scale web=1 # spawn more dynos
## `run` - Running ### `restart`
heroku restart
### `run` - Running
heroku run bash heroku run bash
heroku run console # Rails console heroku run console # Rails console
heroku run rake assets:precompile heroku run rake assets:precompile
## `config` - Environment var configuration ### `config` - Environment var configuration
heroku config # List heroku config # List
heroku config -s # List in shell format heroku config -s # List in shell format
@ -61,7 +65,7 @@ layout: default
heroku config:unset KEY1 heroku config:unset KEY1
## `apps` - Applications ### `apps` - Applications
heroku apps # list heroku apps # list
heroku apps:create [NAME] heroku apps:create [NAME]
@ -70,7 +74,12 @@ layout: default
heroku apps:open # open in browser heroku apps:open # open in browser
heroku apps:rename NEWNAME heroku apps:rename NEWNAME
## `domains` - Custom domains ### `maintenance`
heroku maintenance:on
heroku maintenance:off
### `domains` - Custom domains
# Add both! # Add both!
heroku domains:add example.com heroku domains:add example.com
@ -80,7 +89,7 @@ layout: default
heroku domains:clear heroku domains:clear
heroku domains:remove example.com heroku domains:remove example.com
## DNS records ### DNS records
# Root domains # Root domains
mydomain.com. (A) mydomain.com. (A)
@ -92,13 +101,13 @@ layout: default
.mydomain.com. (CNAME) .mydomain.com. (CNAME)
=> proxy.heroku.com => proxy.heroku.com
## Wildcard domains ### Wildcard domains
heroku addons:add wildcard_domains heroku addons:add wildcard_domains
*.yourdomain.com => heroku.com *.yourdomain.com => heroku.com
## htpasswd (for PHP apps) ### htpasswd (for PHP apps)
Create an `.htaccess` file in the webroot: Create an `.htaccess` file in the webroot:
@ -113,7 +122,7 @@ Create a `.htpasswd` file:
See https://gist.github.com/3316425 See https://gist.github.com/3316425
## References: ### References:
* https://addons.heroku.com/ * https://addons.heroku.com/
* https://devcenter.heroku.com/ * https://devcenter.heroku.com/

65
ios-provision.md Normal file
View File

@ -0,0 +1,65 @@
---
title: iOS Provisioning Profiles
layout: default
---
### Types of profiles
* __Development__ - deploy to an iPhone via XCode
* __Adhoc__ - deploy via testflightapp.com
* __Appstore__ - only used for submitting to the app store
### Requirements
| What | Dev | Adhoc | Appstore |
|-----------------|-----|-------|----------|
| CSR file | | √ | √ |
| Device UDIDs | √ | √ | |
| Developers list | √ | | |
### Obtaining a CSR file
Needed for Adhoc & Appstore builds.
* Open *Keychain Access.app*
* *Keychain Access* menu -> *Certificate Assistant* menu -> *Request a
certificate...*
* User email address is *your email*
* Common name is *your name*
* CA Email address is *blank*
* Request is *Saved to disk*
### Get the `.cer` files
Needed for Adhoc & Appstore builds.
* in the iOS dev portal, go to *Certificates*, and download the certificate.
Install it on the dev machine.
### Obtaining device UDIDs
Needed for Dev and Adhoc builds.
* via iTunes: http://whatsmyudid.com
* via XCode: cmd+shift+2 (Organizer), Devices
For developers
--------------
Don't ever ask Xcode to *Fix issue...* for you.
### Using a provisioning profile
No need to use `.mobileprovision` files since XCode 5.
* Open the `*.mobileprovision` file using Finder
* XCode Project -> *Build settings* tab -> *Code signing* section ->
*Provisioning Profile* section
* Set *Debug* to the *development* profile
* Set *Release* to the *ad-hoc* profile
### Building an .ipa (Adhoc or Appstore)
* In the toolbar, select "iOS Device" as the target
* *Product* menu -> *Archive*
* In the Organizer (Cmd+Shift+2) -> *Archives* tab -> *Distribute...* button

48
make-assets.md Normal file
View File

@ -0,0 +1,48 @@
---
title: Make for assets
layout: default
---
### Basic compiling
bin := ./node_modules/.bin
all: build/foo.js
build/%.js: src/%.coffee
@$(bin)/coffee < $^ > $@
### Stylus + Autoprefixer
bin := ./node_modules/.bin
stylus := $(bin)/stylus
autoprefixer := $(bin)/autoprefixer
styl_files := $(shell find web/ -name "*.styl")
all: public/app.css
public/app.css: css/app.styl
%.css: %.styl $(styl_files)
@$(stylus) $< | $(autoprefixer) -b "> 1%" > $@
### Hint
hint:
$(js_files)
### Watching
watch:
@echo "... watching for changes"
@while true; do make -s; sleep 1; done
### Browserify
js_files := $(shell find web/ -name "*.js")
public/app.js: web/app.js
public/vendor.js: web/vendor.js
public/%.js: web/%.js $(js_files)
$(browserify) -t [ cssify -x .css ] $< > $@

View File

@ -5,24 +5,27 @@ layout: default
### Var assignment ### Var assignment
JS_COMPRESSOR := $(uglify) uglify = $(uglify) # assignment
compressor := $(uglify) # lazy assignment
# Safe assignment prefix ?= /usr/local # safe assignment
prefix ?= /usr/local
### Magic variables ### Magic variables
$^ -- dependencies out.o: src.c src.h
$@ -- the thing to be built $@ - "out.o" (target)
$< - "src.c" (first prerequisite)
$^ - "src.c src.h" (all prerequisites)
$@ -- Rule target %.o: %.c
$% -- Target member name ('foo' in 'foo.c' for '%.c') $% - target member name ("foo" in "foo.c")
$^ -- Prerequisites (all, without duplication)
$+ -- Prerequisites (all, with duplication) also:
$? -- Prerequisites (new ones) $+ - prerequisites (all, with duplication)
$| -- Prerequisites (order-only?) $? - prerequisites (new ones)
$< -- Prerequisite (first) $| - prerequisites (order-only?)
$* -- Basename without extension of the target (?) $* - basename without extension of the target (?)
$(@D) - target directory
### Command prefixes ### Command prefixes
@ -30,51 +33,56 @@ layout: default
@ Don't print command @ Don't print command
+ Run even if Make is in 'don't execute' mode + Run even if Make is in 'don't execute' mode
Examples:
build: build:
@echo "Building" @echo "compiling"
-gcc $< $@ -gcc $< $@
@echo "Construction complete"
-include .depend -include .depend
### Cool stuff
gitdir ?= $(shell git --exec-path)
gitver ?= $(word 3,$(shell git --version))
### Find files ### Find files
FILES = $(shell find images -name "*") js_files := $(wildcard test/*.js)
FILES = $(shell find test/*.js) all_files := $(shell find images -name "*")
$(patsubst images/%, assets/%, $(shell find images -name "*"))
### Substitutions ### Substitutions
# Same file = $(SOURCE:.cpp=.o) # foo.cpp => foo.o
$(SOURCE:.cpp=.o) outputs = $(files:src/%.coffee=lib/%.js)
$(patsubst %.cpp, %.c, $(SOURCES))
outputs = $(patsubst %.c, %.o, $(wildcard *.c))
assets = $(patsubst images/%, assets/%, $(wildcard images/*))
### More functions
$(strip $(string_var)) $(strip $(string_var))
$(filter %.less, $(files)) $(filter %.less, $(files))
$(filter-out %.less, $(files)) $(filter-out %.less, $(files))
### Executing
JS_COMPRESSOR := $(uglify)
docs:
$(JS_COMPRESSOR) file.js
### Building files ### Building files
%.o: %.c %.o: %.c
ffmpeg -i $< > $@ # Input and output ffmpeg -i $< > $@ # Input and output
foo $^ foo $^
### Inclusion ### Includes
include assets.make -include foo.make
### Options
make
-e, --environment-overrides
-B, --always-make
-s, --silent
-j, --jobs=N # parallel processing
### Conditionals
foo: $(objects)
ifeq ($(CC),gcc)
$(CC) -o foo $(objects) $(libs_for_gcc)
else
$(CC) -o foo $(objects) $(normal_libs)
endif

View File

@ -12,52 +12,46 @@ layout: default
"author": "Rico Sta. Cruz <hi@ricostacruz.com>", "author": "Rico Sta. Cruz <hi@ricostacruz.com>",
"version": "0.1.0", "version": "0.1.0",
"engines": {"node": ">=0.8.0"}, "engines": {"node": ">=0.8.0"},
"main": "index",
"bin": {
"command": "./bin/command"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/rstacruz/___.git" "url": "https://github.com/rstacruz/___.git"
}, },
"license": "MIT"
} }
### Dependencies ### Dependencies
"dependencies": { "dependencies": {
"colors" : "*", "colors" : "*",
"flatiron" : "0.1.x", "flatiron" : "0.1.x",
"flatiron" : "~0.1.0", "flatiron" : "~0.1.0",
"plates" : "https://github.com/:user/:project/tarball/:branch", "plates" : "https://github.com/user/project/tarball/branch",
"stuff": "git://github.com/user/project.git#commit-ish" "stuff" : "git://github.com/user/project.git#commit-ish"
},
"devDependencies": {
...
}, },
"devDependencies": { ... },
### Scripts ### Scripts
"scripts": { "scripts": {
"start": "node ./bin/xxx", /* npm start */ "start": "node ./bin/xxx", /* npm start */
"test": "vows --spec --isolate", /* npm test */ "test": "vows --spec --isolate", /* npm test */
"postinstall": "...",
"prepublish": "grunt build", /* after 'npm install' and before 'npm
publish' */
} }
### Git
"repository": {
"type": "git",
"url": "https://github.com/nodejitsu/http-server.git"
},
### Main entry point
"main": "index",
"main": "./lib/http-server",
### Bin
"bin": {
"command": "./bin/command"
},
### Misc ### Misc
"private": true, "private": true,
"preferGlobal": true, "preferGlobal": true
"license": "MIT"
[Reference](http://package.json.nodejitsu.com/) (Nodejitsu.com) ### References
* http://package.json.nodejitsu.com/
* `npm help package.json`