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
$ rake -T routes | |
rake routes # Print out all defined routes in match order, with names | |
rake routes:csv # Print out all defined routes in CSV format | |
$ rake routes:csv | |
Prefix, Verb, URI Pattern, Controller#Action | |
data, GET, /data(.:format), data#index | |
, POST, /data(.:format), data#create | |
new_datum, GET, /data/new(.:format), data#new | |
edit_datum, GET, /data/:id/edit(.:format), data#edit |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Treegrid using json</title> | |
<link rel="stylesheet" type="text/css" media="screen" href="css/ui-lightness/jquery-ui-1.8.17.custom.css" /> | |
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" /> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
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
#! /bin/bash | |
set -euf -o pipefail | |
function cleanup { | |
for pid in "${opencv_download_pid:-''}" "${contrib_download_pid:-''}" "${pip_install_pid:-''}"; do | |
if [ -z "${pid}" ]; then | |
kill "${pid}" | |
fi | |
done |
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
class ChangeColumnToUser < ActiveRecord::Migration[5.0] | |
def change | |
# 追加 | |
add_column :users, :piyo, :string | |
add_column :users, :piyo2, :string | |
# 削除 | |
remove_column :users, :piyo2, :string | |
# rename | |
rename_column :users, :name_x, :name | |
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
# coding: utf-8 | |
# See Book "http://ptgmedia.pearsoncmg.com/images/9780321942043/samplepages/9780321942043.pdf" | |
# "From Mathematics to Generic Programming" | |
def odd?(n) | |
(n & 1) == 1 | |
end | |
def half(n) | |
n >> 1 | |
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
// See http://techlife.cookpad.com/entry/2014/11/12/170041 | |
// | |
// 本来はplayground用に用意されているXCPlaygroundフレームワークのXCPShowViewを使って | |
// Timelineに表示することが可能ですが、現行のXcode6.1でiOS用にUIKitを使って表示した場合 | |
// コンソールにエラーが出てしまうため使用していません。 | |
// | |
import UIKit | |
// ビューのサイズ |
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
# See | |
# http://qiita.com/jnchito/items/640f17e124ab263a54dd | |
require 'spec_helper' | |
class WeatherBot | |
def tweet_forecast | |
twitter_client.update '今日は晴れです' | |
rescue => e |
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
# -*- coding: utf-8 -*- | |
# 演算子の優先度を返す | |
OP_INFO = { | |
# 演算子 => [優先度、演算] | |
'+' => { priority: 1, func: 'func_add' }, | |
'-' => { priority: 1, func: 'func_sub' }, | |
'*' => { priority: 2, func: 'func_mul' }, | |
'/' => { priority: 2, func: 'func_div' }, | |
# '**' => { priority: 3, func: 'func_exp' }, |
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
# -*- coding: utf-8 -*- | |
require 'logger' | |
STDOUT.sync = true | |
STDERR.sync = true | |
def get_logger | |
ret = Logger.new(File.join(File.dirname(File.expand_path(__FILE__)), 'test.log')) | |
ret.level = Logger::INFO |
NewerOlder