- 13:30-13:45 Opening
- 13:45-14:15 Sponsor session 1 Ayumu AIZAWA "Heroku"
- 14:30-15:00 Sponsor session 2 Kazunori Hirano "Microsoft's Openness Vision and Strategy. MS <3 (Loves) Ruby and Linux!"
- 15:00-15:30 Sponsor session 3 Kenichi TAKAHASHI "Social Coding, It's Not Unusual in ESM"
- 15:45-16:15 Sponsor session 4 Masahiro Ihara "How to create COOKPAD"
- 16:30-17:00 Yuichi Tateno (@hotchpotch / id:secondlife) "Technology that drives fun cooking 2012" Gosuke Miyashita
This file contains 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
def quicksort(seq) | |
if seq.size == 0 | |
return seq | |
end | |
pivot = seq[0] | |
right = Array.new | |
left = Array.new | |
for i in 1..seq.size-1 | |
if seq[i] <= pivot | |
left.push(seq[i]) |
##GitHubとHerokuに両対応させるには
-
herokuでapp:create
$ heroku apps:create p120902-jishiha-search Creating p120905-rss-process-test... done, stack is cedar http://p120905-rss-process-test.herokuapp.com/ | [email protected]:p120905-rss-process-test.git
-
$ git clone https://github.com/weed/p120902-jishiha-search.git
-
作業
This file contains 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
namespace :heroku do | |
desc "PostgreSQL database backups from Heroku to Amazon S3" | |
task :backup => :environment do | |
begin | |
require 'right_aws' | |
puts "[#{Time.now}] heroku:backup started" | |
name = "#{ENV['APP_NAME']}-#{Time.now.strftime('%Y-%m-%d-%H%M%S')}.dump" | |
db = ENV['DATABASE_URL'].match(/postgres:\/\/([^:]+):([^@]+)@([^\/]+)\/(.+)/) | |
system "PGPASSWORD=#{db[2]} pg_dump -Fc --username=#{db[1]} --host=#{db[3]} #{db[4]} > tmp/#{name}" | |
s3 = RightAws::S3.new(ENV['s3_access_key_id'], ENV['s3_secret_access_key']) |
This file contains 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
# Heroku S3 Database backup task | |
# by Nick Merwin (Lemur Heavy Industries) 10.08.09 | |
# * dumps db to yaml, gzip's and sends to S3 | |
# | |
# Setup: | |
# 1) replace APP_NAME and BACKUP_BUCKET with your info | |
# 2) add config/s3.yml like so (same as Paperclip's): | |
# production: | |
# access_key_id: ... | |
# secret_access_key: ... |
This file contains 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
desc "This task is called by the Heroku cron add-on" | |
task :cron => :environment do | |
Rake::Task['heroku:backup'].invoke | |
end |
This file contains 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
require "heroku" | |
require "heroku/command" | |
require 'aws/s3' | |
namespace :backups do | |
desc "create a pg_dump and send to S3" | |
task :backup => :environment do | |
include RRBOUtil |
This file contains 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
task :cron => :environment do | |
# removes day old sessions from the database | |
puts "====> Removing stale sessions from the database…” | |
Rake::Task['db:sessions:clear_stale'].execute | |
# run the following tasks on sunday | |
if Time.now.wday == 0 | |
# backs up the database to S3 | |
puts "====> Backing up database to S3…” |
This file contains 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
# This gist is documented at http://ctoinsights.wordpress.com/2011/11/26/running-heroku-workers-only-when-required/ | |
class HerokuManager | |
def heroku | |
@heroku ||= Heroku::Client.new(HEROKU_USERNAME, HEROKU_PASSWORD) | |
end | |
def stack | |
heroku.list_stacks(HEROKU_APP_NAME).inject("") do |current,stack| | |
stack["current"] ? stack["name"] : current | |
end |
This file contains 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
# Scale workers on Heroku automatically as your Resque queue grows. | |
# Mixin the +Scaling+ module into your models to get the behavior. | |
# | |
# class MyModel < ActiveRecord::Base | |
# extend HerokuAutoScaler::AutoScaling | |
# end | |
# | |
# And configure in an initializer +config/initializers/heroku_workers.rb+: | |
# | |
# HerokuAutoScaler.configure do |