This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.
Please make sure that your Gemfile in your rails application includes unicorn.
#!/bin/sh | |
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
# CREATE block and create them in separate commands _after_ all the INSERTs. | |
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
# The mysqldump file is traversed only once. | |
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
#!/bin/bash | |
APP_NAME="your-app-name-goes-here" | |
APP_PATH=/home/deploy/${APP_NAME} | |
# Production environment | |
export RAILS_ENV="production" | |
# This loads RVM into a shell session. Uncomment if you're using RVM system wide. | |
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" |
Dear Rubyists,
I just lost a contract because of my code in a Rails project.
The specific code in question is related to a "posting a comment" feature. Here are the details:
In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.
The "senior developer", whom is the stake holder's right hand man, said this:
(* | |
(* CR jfuruse: なんたら *) というのは前職でのコードレビューの書き方で、私の癖になっている。すべて、「私ならば…こうするかな?」が省略されています。 | |
私ならやっつけモードでこう書く、という例です。人様のコードを元にしているので、ほんとにこう書くのかよ?という突っ込みはありかと思います。 | |
元コードも実際のものを簡略化されたものだそうですので、私の提案コードのように書きたいけれども実は書けないんだ!ということもあるでしょう。 | |
OCaml のプログラミングスタイルは決まったものはなくいろいろと流儀があります。その一つと思ってください。 | |
*) |
a=b=c=(1..100).each do |num| | |
print num, ?\r, | |
("Fizz" unless (a = !a) .. (a = !a)), | |
("Buzz" unless (b = !b) ... !((c = !c) .. (c = !c))), | |
?\n | |
end |
#! /bin/sh | |
# | |
# parsrc.sh | |
# CSV(Excel形式(RFC 4180):ダブルクォーテーションのエスケープは"")から | |
# 行番号列番号インデックス付き値(line field indexed value)テキストへの正規化 | |
# (例) | |
# aaa,"b""bb","c | |
# cc",d d | |
# "f,f" | |
# ↓ |
diff --git a/lib/stripe.rb b/lib/stripe.rb | |
index fb4a6a6..7e77804 100644 | |
--- a/lib/stripe.rb | |
+++ b/lib/stripe.rb | |
@@ -46,7 +46,7 @@ require 'stripe/errors/authentication_error' | |
module Stripe | |
@@ssl_bundle_path = File.join(File.dirname(__FILE__), 'data/ca-certificates.crt') | |
@@api_key = nil | |
- @@api_base = 'https://api.stripe.com/v1' | |
+ @@api_base = 'https://api.webpay.jp/v1' |