Skip to content

Instantly share code, notes, and snippets.

View meriy100's full-sized avatar

meriy100 meriy100

View GitHub Profile
# spec/features/exam.feature
# encoding: utf-8
Feature: テスト管理
@teachers
@exams
Scenario: 学習スケジュールが無い小テストを編集できる
Given 先生がログインする
Given 1-1 クラスを用意
Given 2018-07-01 に小テストを用意
@meriy100
meriy100 / file0.txt
Last active September 12, 2018 08:45
安全な! migration ファイルの作り方 ref: https://qiita.com/meriy100/items/b63f44496a31e2f7c9fc
class ChangeColumnsToBooks < ActiveRecord::Migration[5.0]
def change
add_column :books, :name, :string
add_index :books, :isin, unique: true # <= ここでコケると面倒
end
end
#include <stdio.h>
int josephus ( int n ) {
int result ;
if ( ( n == 1 ) || ( n < 1 ) ) {
return 1 ;
}
else if ( n % 2 == 0 ) {
result = 2 * josephus ( n / 2 ) - 1 ;
return result ;
}
@meriy100
meriy100 / file0.txt
Last active January 17, 2018 15:08
ActiveRecord だけを使いたいとき ref: https://qiita.com/meriy100/items/4e1a74334314ed587862
require 'active_record'
# Rails で言うところの config/database.yml
ActiveRecord::Base.establish_connection(
adapter: 'mysql2',
host: 'localhost',
username: 'username',
password: 'password',
database: 'database',
# ....
)
@meriy100
meriy100 / Test.md
Last active September 25, 2017 10:11
  • aaa
#<Google::Apis::CalendarV3::Event:0x007fd41266bd20
@created=Thu, 14 Apr 2016 03:39:34 +0000,
@creator=#<Google::Apis::CalendarV3::Event::Creator:0x007fd41166b268 @email="sw.kariyado.kouta@gmail.com", @self=true>,
@description="F204",
@end=#<Google::Apis::CalendarV3::EventDateTime:0x007fd4116689f0 @date_time=Wed, 03 Aug 2016 09:30:00 +0000, @time_zone="Asia/Tokyo">,
@etag="\"2921210389670000\"",
@html_link="https://www.google.com/calendar/event?eid=Xzhrcmo2YzlpOHAya2NiOWc4aDEzY2I5azg0cGppYmExNjUyNDhiYTQ4b3FqZWU5bzZncms2aDFnNzBfMjAxNjA4MDNUMDAwMDAwWiBzdy5rYXJpeWFkby5rb3V0YUBt",
@i_cal_uid="E7312FEF-0DB6-4A39-A1DD-DF579847CD08",
@id="_8krj6c9i8p2kcb9g8h13cb9k84pjiba165248ba48oqjee9o6grk6h1g70",
@kind="calendar#event",
class Todoist < ActiveModel
attr_accessor :token
end
// test.html.slim
// @tasks = [taks1, task2, ..., taskn]
== render partial: "a", collection: @tasks
// _a.html.slim
= task.title
= task.color
GET /chat HTTP/1.1
Host: server.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Origin: http://example.com
Sec-WebSocket-Protocol: chat, superchat
Sec-WebSocket-Version: 13