- apt-get install apache2 -y
- apt-get install libapache2-mod-proxy-html libxml2-dev -y
- a2enmod headers
- a2enmod proxy
- a2enmod proxy_http
- a2enmod proxy_balancer
- a2enmod rewrite
- a2enmod ssl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| References: | |
| http://blog.carbonfive.com/2012/02/27/supporting-cross-domain-ajax-in-rails-using-jsonp-and-cors/ | |
| https://github.com/cyu/rack-cors | |
| http://nelm.io/blog/2011/11/cors-with-sencha-touch/ | |
| http://jessehowarth.com/2011/04/27/ajax-login-with-devise | |
| ============================================================================================================= | |
| GEMFILE | |
| ============================================================================================================= | |
| gem 'rack-cors', :require => 'rack/cors' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: unicorn | |
| # Required-Start: $local_fs $remote_fs mysql | |
| # Required-Stop: $local_fs $remote_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: unicorn initscript | |
| # Description: Unicorn is an HTTP server for Rack application | |
| ### END INIT INFO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add Action button on the top navigation menu. Useful for resource with nested resources | |
| action_item :only => :show do | |
| link_to('Show Users', admin_group_users_path(resource)) | |
| end | |
| # Custom show page with children items | |
| show do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get the Heroku db as detailed here: | |
| http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup | |
| 1. heroku pgbackups:capture | |
| 2. heroku pgbackups:url <backup_num> #=>backup_url | |
| - get backup_num with cmd "heroku pgbackups" | |
| 3. curl -o latest.dump <backup_url> | |
| Then locally do: | |
| $ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.ajaxSetup( | |
| beforeSend: (xhr) -> | |
| xhr.setRequestHeader('X-Auth-Token', | |
| App.Session.getAuthenticationToken()) | |
| ) | |
| # ... | |
| class App.Session | |
| # ... | |
| getAuthenticationToken: -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SSL self signed localhost for rails start to finish, no red warnings. | |
| # 1) Create your private key (any password will do, we remove it below) | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Rails 4 Application Template | |
| # Usage: rails new [app_name] -m [boost_template.rb] -d postgresql | |
| # Remove normal files we don't want | |
| remove_file "README.rdoc" | |
| remove_file "public/index.html" | |
| remove_file "app/assets/images/rails.png" | |
| # Copy database.yml to sample | |
| inside "config" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @font-face { | |
| font-family: 'EntypoRegular'; | |
| src: url('font/entypo.eot'); | |
| src: url('font/entypo.eot?#iefix') format('embedded-opentype'), | |
| url('font/entypo.woff') format('woff'), | |
| url('font/entypo.ttf') format('truetype'), | |
| url('font/entypo.svg#EntypoRegular') format('svg'); | |
| font-weight: normal; | |
| font-style: normal; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env bash | |
| cd '../source/' | |
| for PHOTO in *.jpg | |
| do | |
| filename="$(echo $PHOTO | cut -d'.' -f 1 | sed 's/ /_/g')" | |
| filename=`basename $filename` | |
| convert "$PHOTO" -resize "600x600^" -gravity center -crop 600x600+0+0 +repage "../processed/$filename.jpg" | |
| done |