From 8087cc36f8ca1c8b8ecccc670ebc74c7c78a92a6 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Tue, 15 Jul 2014 21:35:11 +0800 Subject: [PATCH] Update Heroku. --- bootstrap.md | 15 +++++---- docker-osx.md | 43 ++++++++++++++++++++++++ heroku.md | 37 +++++++++++++-------- ios-provision.md | 65 ++++++++++++++++++++++++++++++++++++ make-assets.md | 48 +++++++++++++++++++++++++++ makefile.md | 86 ++++++++++++++++++++++++++---------------------- package.md | 48 ++++++++++++--------------- 7 files changed, 255 insertions(+), 87 deletions(-) create mode 100644 docker-osx.md create mode 100644 ios-provision.md create mode 100644 make-assets.md diff --git a/bootstrap.md b/bootstrap.md index 16e47c26c..d67eb9ec6 100644 --- a/bootstrap.md +++ b/bootstrap.md @@ -8,19 +8,20 @@ layout: default 768 992 1200 ' ' ' ' ' ' ' ' ' <---------^------------^------------------^---------> - xs sm md lg + xs sm md lg + (phone) (tablet) (laptop) (desktop) Min: - @media (min-width: @screen-sm-min) /* small >= 768px tablet */ - @media (min-width: @screen-md-min) /* medium >= 992px desktop */ - @media (min-width: @screen-lg-min) /* large >= 1200px big desktop */ + @media (min-width: @screen-sm-min) { /* >= 768px (small tablet) */ + @media (min-width: @screen-md-min) { /* >= 992px (medium laptop) */ + @media (min-width: @screen-lg-min) { /* >= 1200px (large desktop) */ Max: - @media (max-width: @screen-xs-max) /* xsmall < 768px phone */ - @media (max-width: @screen-sm-max) /* smalll < 992px tablet */ - @media (max-width: @screen-md-max) /* medium < 1200px desktop */ + @media (max-width: @screen-xs-max) { /* < 768px (xsmall phone) */ + @media (max-width: @screen-sm-max) { /* < 992px (small tablet) */ + @media (max-width: @screen-md-max) { /* < 1200px (medium laptop) */ ### Columns diff --git a/docker-osx.md b/docker-osx.md new file mode 100644 index 000000000..63e9047cc --- /dev/null +++ b/docker-osx.md @@ -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/ diff --git a/heroku.md b/heroku.md index aef1a593a..34105372b 100644 --- a/heroku.md +++ b/heroku.md @@ -3,11 +3,11 @@ title: Heroku layout: default --- -## `create` - Create an app +### `create` - Create an app heroku create sushi -## `sharing` - Collaboration +### `sharing` - Collaboration # Manage collaborators heroku sharing # List @@ -17,19 +17,19 @@ layout: default # Transfer to another owner heroku sharing:transfer new@owner.com -## `logs` - Show logs +### `logs` - Show logs heroku logs heroku logs -t # --tail (stream) heroku logs -s app # --source (only on app logs) -## `releases` +### `releases` heroku releases heroku releases:info v25 heroku rollback -## `pg` - Postgresql +### `pg` - Postgresql # Start a database heroku addons:add heroku-postgresql @@ -38,18 +38,22 @@ layout: default # Enable backups heroku addons:add pgbackups:auto-month -## `ps` - Managing processes +### `ps` - Managing processes heroku ps # list heroku ps:scale web=1 # spawn more dynos -## `run` - Running +### `restart` + + heroku restart + +### `run` - Running heroku run bash heroku run console # Rails console heroku run rake assets:precompile -## `config` - Environment var configuration +### `config` - Environment var configuration heroku config # List heroku config -s # List in shell format @@ -61,7 +65,7 @@ layout: default heroku config:unset KEY1 -## `apps` - Applications +### `apps` - Applications heroku apps # list heroku apps:create [NAME] @@ -70,7 +74,12 @@ layout: default heroku apps:open # open in browser heroku apps:rename NEWNAME -## `domains` - Custom domains +### `maintenance` + + heroku maintenance:on + heroku maintenance:off + +### `domains` - Custom domains # Add both! heroku domains:add example.com @@ -80,7 +89,7 @@ layout: default heroku domains:clear heroku domains:remove example.com -## DNS records +### DNS records # Root domains mydomain.com. (A) @@ -92,13 +101,13 @@ layout: default .mydomain.com. (CNAME) => proxy.heroku.com -## Wildcard domains +### Wildcard domains heroku addons:add wildcard_domains *.yourdomain.com => heroku.com -## htpasswd (for PHP apps) +### htpasswd (for PHP apps) Create an `.htaccess` file in the webroot: @@ -113,7 +122,7 @@ Create a `.htpasswd` file: See https://gist.github.com/3316425 -## References: +### References: * https://addons.heroku.com/ * https://devcenter.heroku.com/ diff --git a/ios-provision.md b/ios-provision.md new file mode 100644 index 000000000..55e347332 --- /dev/null +++ b/ios-provision.md @@ -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 diff --git a/make-assets.md b/make-assets.md new file mode 100644 index 000000000..648ca9a39 --- /dev/null +++ b/make-assets.md @@ -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 ] $< > $@ diff --git a/makefile.md b/makefile.md index 4075c5cfb..db9799298 100644 --- a/makefile.md +++ b/makefile.md @@ -5,24 +5,27 @@ layout: default ### Var assignment - JS_COMPRESSOR := $(uglify) - - # Safe assignment - prefix ?= /usr/local + uglify = $(uglify) # assignment + compressor := $(uglify) # lazy assignment + prefix ?= /usr/local # safe assignment ### Magic variables - $^ -- dependencies - $@ -- the thing to be built + out.o: src.c src.h + $@ - "out.o" (target) + $< - "src.c" (first prerequisite) + $^ - "src.c src.h" (all prerequisites) - $@ -- 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 (?) + %.o: %.c + $% - target member name ("foo" in "foo.c") + + also: + $+ - prerequisites (all, with duplication) + $? - prerequisites (new ones) + $| - prerequisites (order-only?) + $* - basename without extension of the target (?) + + $(@D) - target directory ### Command prefixes @@ -30,51 +33,56 @@ layout: default @ Don't print command + Run even if Make is in 'don't execute' mode -Examples: - build: - @echo "Building" + @echo "compiling" -gcc $< $@ - @echo "Construction complete" -include .depend -### Cool stuff - - gitdir ?= $(shell git --exec-path) - gitver ?= $(word 3,$(shell git --version)) - ### Find files - FILES = $(shell find images -name "*") - FILES = $(shell find test/*.js) - - $(patsubst images/%, assets/%, $(shell find images -name "*")) + js_files := $(wildcard test/*.js) + all_files := $(shell find images -name "*") ### Substitutions - # Same - $(SOURCE:.cpp=.o) - $(patsubst %.cpp, %.c, $(SOURCES)) + file = $(SOURCE:.cpp=.o) # foo.cpp => foo.o + outputs = $(files:src/%.coffee=lib/%.js) + + outputs = $(patsubst %.c, %.o, $(wildcard *.c)) + assets = $(patsubst images/%, assets/%, $(wildcard images/*)) + +### More functions $(strip $(string_var)) $(filter %.less, $(files)) $(filter-out %.less, $(files)) -### Executing - - JS_COMPRESSOR := $(uglify) - - docs: - $(JS_COMPRESSOR) file.js - ### Building files %.o: %.c ffmpeg -i $< > $@ # Input and output 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 diff --git a/package.md b/package.md index 67d0d2a2b..f0a2b1302 100644 --- a/package.md +++ b/package.md @@ -12,52 +12,46 @@ layout: default "author": "Rico Sta. Cruz ", "version": "0.1.0", "engines": {"node": ">=0.8.0"}, + "main": "index", + "bin": { + "command": "./bin/command" + }, "repository": { "type": "git", "url": "https://github.com/rstacruz/___.git" }, + "license": "MIT" } ### Dependencies "dependencies": { - "colors" : "*", - "flatiron" : "0.1.x", - "flatiron" : "~0.1.0", - "plates" : "https://github.com/:user/:project/tarball/:branch", - "stuff": "git://github.com/user/project.git#commit-ish" + "colors" : "*", + "flatiron" : "0.1.x", + "flatiron" : "~0.1.0", + "plates" : "https://github.com/user/project/tarball/branch", + "stuff" : "git://github.com/user/project.git#commit-ish" + }, + "devDependencies": { + ... }, - "devDependencies": { ... }, ### Scripts "scripts": { "start": "node ./bin/xxx", /* npm start */ "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 "private": true, - "preferGlobal": true, - "license": "MIT" + "preferGlobal": true -[Reference](http://package.json.nodejitsu.com/) (Nodejitsu.com) +### References + + * http://package.json.nodejitsu.com/ + * `npm help package.json`