(1) 摂氏温度を華氏温度に変換するメソッド
f = c * 9 / 5 + 32
(2) 華氏を摂氏に変換するメソッド
移項して変換式を求める。→移項とは両辺に同じ数を足す・引く・掛ける・割る
# 1レコードで複数のURLパラメータを埋めるためのパッチ | |
# /users/1/posts/2 のとき Post モデルに additional_path_args を以下のように定義すれば | |
# url_for(post) や link_to post と書けるようになる。 | |
# def additional_path_args | |
# user | |
# end | |
module HelperMethodBuilderExt | |
def handle_model(record) | |
named_route, args = super | |
[named_route, expand_args(args, record)] |
/* | |
This widget shows Recent Posts on your Tumblr blog. | |
Its dependency is jQuery. | |
Usage: | |
1) Add html: | |
<div id="recent-posts"></div> | |
2) Download this script and upload it on your server. |
# jQuery optgroupDoubleSelect plugin | |
# Rewrite of jDoubleSelect | |
# Copyright (c) Giovanni Casassa & Toru Kawamura | |
# | |
# Dual licensed under the MIT (MIT-LICENSE.txt) | |
# and GPL (GPL-LICENSE.txt) licenses. | |
# | |
# http://www.senamion.com/blog/jDoubleSelect.html | |
jQuery ($) -> |
Rails Girls ガイド の復習をしました。
インストール済み:ruby 1.9.3, rbenv, rails 4.1.0
Spring問題で動かず。 RailsでSpringが動かないとき (Mac) [ uninitialized constant Spring::SID::DL ] - tkymtk's blog
Rails Girls ガイド を最初から進めていきました。
Mac OS X 10.9.2
ステップ 3-Bに従って、rbenvを使ってRuby 2.1.2をインストール。
(function () { | |
"use strict"; | |
function loadCSS(href) { | |
document.write('<link rel="stylesheet" type="text/css" href="' + href + '" />'); | |
} | |
function loadJS(src) { | |
var s = document.createElement('script'); | |
s.src = src; |
# coupled | |
(1..100).each do |i| | |
answer = HTTP.get("/v1/fizzbuzz?number=#{i}") | |
puts answer | |
end | |
# decoupled | |
root = HTTP.get_root | |
answer = root.link('first').follow | |
puts answer |