Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@igaiga
igaiga / test.rb
Last active August 29, 2015 14:02
a = [1,2,3,4]
Hash[*a] #=> {1=>2, 3=>4}
a.each_slice(2).to_h #=> {1=>2, 3=>4}
(通信)規約
HTTP : インターネットで通信するためのきまり
HTTPS : HTTPのセキュア通信版
TCP/IP : インターネット通信のきまり。HTTPの土台になっている。
インフラ
github : ソースコードのSNS
git : コードのログを取る仕組み
apache : rails server と同じ server の一種
class Category < ActiveRecord::Base
scope :name, ->(category) { where(name: category )}
end
Category.name("restaurants")
@igaiga
igaiga / problems.txt
Last active August 29, 2015 14:05
問題集
■Ruby(初級) 1と2と3の和を計算して表示してください。
■Ruby(初級) 文字列 "write" 中の e を ten に置換し、 "written"にして表示するコードを書いてください。
■Ruby(中級) Arrayオブジェクトの要素が奇数の項目を全て足すコードを書いてください。例えば array = [2,3,5,7,11] の場合、 (3+5+7+11=) 26 が表示されればOKです。
■Rails (初級) 現在時刻を表示するrailsアプリを作ってください。時刻表示の更新タイミングはアクセス時とします。(表示したら、リロードするまで表示が更新されなくても良いです。)
■Rails (中級) おみくじを表示するrailsアプリを作ってください。おみくじの結果は大吉、中吉、小吉、吉、凶 として、凶をほかの候補よりも少しだけ出難くくしてください。
@igaiga
igaiga / gist:e60defd948a5283d97be
Last active August 29, 2015 14:06
an abstract
titel: Use cloud services to easily develop Ruby Web applications
abstract: (We only have a space of 200 chars.)
One of the biggest problems when beginning web app development is setting up the development environment.
In this talk, let's talk about how we can easily develop Ruby web apps using cloud services.
株式会社spice lifeはECを通して世の中に笑顔を増やすサービスを作ります。spice lifeで開発するのはECの分野、ちょっと変わった、ちょっと新しい、ちょっと世の中を良くするようなECです。もちろんRailsで開発しています。オリジナルTシャツ作成サービスtmixはいろんな技術カンファレンスのスタッフTシャツ作成もしています。
---
category: /日報/2014/10/09/
title: "五十嵐"
tags:
date: 2014-10-09 11:58:59 +0900
url: https://foo.esa.io/posts/28
---
# 勤務時間
10:00-19:00
key = gets.chomp
@dbh.execute("delete from bookinfos where key = #{key}")
解説
" " でくくった文字列の中で #{変数名}と書くと、変数に代入されている値を文字列にすることができます。
たとえば
foo = "xyz"
"abc #{foo}"
"abc xyz" と同じです。
yesno = gets.chomp.upcase
p "Y!!!" if /^Y$/ =~ yesno
@igaiga
igaiga / config.log
Created October 27, 2014 23:17
Yosemite rbenv install 2.1.4 configure error
configure:3840: checking whether the C compiler works
configure:3862: gcc-4.2 -O3 -Wno-error=shorten-64-to-32 -I/Users/igarashi/.rbe
nv/versions/2.1.4/include -L/Users/igarashi/.rbenv/versions/2.1.4/lib conftest
.c >&5
couldn't understand kern.osversion `14.0.0'
ld: library not found for -lcrt1.o
collect2: ld returned 1 exit status
configure:3866: $? = 1
configure:3904: result: no
configure: failed program was: