前回のコミットから何も変更を加えていない状態。
$ git status
# On branch masternothing to commit, working directory clean
エディタでファイルを編集する
How Unicorn Reaps Worker Processes | |
RubyによるUnixプログラミングを掘り下げるなら、Unicorn web サーバーについても触れておく必要がある。既にこの本でも何度かUnicornについて言及をしてきた。 | |
Unicornの何が凄いのか?Unicornはkernelの機能を限界まで使いこなしている。 | |
コードベースはUnixプログラミングテクニックで一杯だ。 | |
それだけではなく、効率的で信頼性も備えている。GithubやShopifyといったRubyで構築されているWebサイトの多くがUnicornを使っている。 | |
RubyによるUnixプログラミングについてもっと興味がわいならUnicornの詳細を調べてみるといい。 |
var freshers = ["おっくん", "ぐっさん", "たけお", "きたけー"]; | |
freshers.shuffle = function () { | |
var i = this.length; | |
var j = 0; | |
var tmp = ""; | |
while(i) { | |
j = Math.floor(Math.random()*i); | |
i--; | |
tmp = this[i]; |
require 'mechanize' | |
class IshikawaAirPollutionAPI | |
def initialize | |
@agent = Mechanize.new | |
@agent.user_agent_alias = 'Mac Safari' | |
@agent.request_headers = { | |
'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | |
'Accept-language' => 'ja-jp', |
var LINE = require('./line.js'); | |
var line = new LINE(); | |
var email = 'your email'; | |
var password = 'your password'; | |
line.login(email, password, function(error, result) { | |
if (error) { | |
return; | |
} |
connection = Faraday::Connection.new('http://example.com') do |builder| | |
builder.request :url_encoded # for POST/PUT params | |
builder.adapter :net_http | |
end | |
# same as above, short form: | |
connection = Faraday.new 'http://example.com' | |
# GET | |
connection.get '/posts' |
//Customise Backbone.sync to work with Titanium rather than jQuery | |
var getUrl = function(object) { | |
if (!(object && object.url)) return null; | |
return _.isFunction(object.url) ? object.url() : object.url; | |
}; | |
Backbone.sync = (function() { | |
var methodMap = { | |
'create': 'POST', | |
'read' : 'GET', |
/** | |
* Enable route to __noSuchMethod__ when unknown method calling. | |
* | |
* @param {Object} obj Target object. | |
* @return {Object} | |
*/ | |
function enableMethodMissing(obj) { | |
var functionHandler = createBaseHandler({}); | |
functionHandler.get = function(receiver, name) { |
I've used Cucumber quite a bit on my last job. It's an excellent tool, and I believe readable tests are the way to the future. But I could never get around to write effective scenarios, or maintain the boatload of text that the suite becomes once you get to a point where you have decent coverage. On top of that, it didn't seem to take much for the suite to become really slow as tests were added.
A while ago I've seen a gist by Lachie Cox where he shows how to use RSpec and Capybara to do front-end tests. That sounded perfect for me. I love RSpec, I can write my own matchers when I need them with little code, and it reads damn nicely.
So for my Rails Rumble 2010 project, as usual, I rolled a Sinatra app and figured I should give the idea a shot. Below are my findings.
// | |
// Base | |
// | |
// this sets the background color of the master UIView (when there are no windows/tab groups on it) | |
Titanium.UI.setBackgroundColor('#000'); | |
// create tab group | |
var tabGroup = Titanium.UI.createTabGroup(); |