FuelPHPでRestコントローラ(WebAPI)を作成するタスクを作成しました。
- ↓のrest.phpを
fuel/app/tasks/
の中に置く - タスクを実行するコマンド(
php oil r rest [name]
)を叩く
#!/usr/bin/ruby | |
#数値を16進数文字列に | |
p 65.to_s(16) #=> "41" | |
#数値をASCII文字に | |
p 65.chr #=> "A" | |
#文字列を16進数とみなして数値に | |
p "41".hex #=> 65 |
Sometimes you want to use a gem on Heroku that is in a private repository on GitHub.
Using git over http you can authenticate to GitHub using basic authentication. However, we don't want to embed usernames and passwords in Gemfiles. Instead, we can use authentication tokens.
First you will need to get an OAuth Token from GitHub using your own username and "note"
# submoduleの削除手順 | |
# 1: .gitmodules から削除したいサブモジュール設定を削除 | |
# 2: .git/config から削除したいサブモジュール設定を削除 | |
# 3: git rm --cached -r path/to/submodule を実行 |
# create the template | |
template = PageOfflineTemplate.new | |
template.quote = quote | |
template.pages = quote.build_pages | |
# Here I render a template with layout to a string then a PDF | |
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml") | |
This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo
bundle install
mate Guardfile
bundle exec jasmine init
mate spec/support/yasmine.ym
bundle exec guard
#Deploy and rollback on Heroku in staging and production | |
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag'] | |
namespace :deploy do | |
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU' | |
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU' | |
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag] | |
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on] |