Skip to content

Instantly share code, notes, and snippets.

meriy100 meriy100

View GitHub Profile
View file0.txt
# 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 Sep 12, 2018
安全な! migration ファイルの作り方 ref: https://qiita.com/meriy100/items/b63f44496a31e2f7c9fc
View file0.txt
class ChangeColumnsToBooks < ActiveRecord::Migration[5.0]
def change
add_column :books, :name, :string
add_index :books, :isin, unique: true # <= ここでコケると面倒
end
end
View 05B1.c
#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 Jan 17, 2018
ActiveRecord だけを使いたいとき ref: https://qiita.com/meriy100/items/4e1a74334314ed587862
View file0.txt
require 'active_record'
# Rails で言うところの config/database.yml
ActiveRecord::Base.establish_connection(
adapter: 'mysql2',
host: 'localhost',
username: 'username',
password: 'password',
database: 'database',
# ....
)
View google_calendar.rb
#<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",
View sake_web.md
View todoist.rb
class Todoist < ActiveModel
attr_accessor :token
end
View test.html.slim
// test.html.slim
// @tasks = [taks1, task2, ..., taskn]
== render partial: "a", collection: @tasks
// _a.html.slim
= task.title
= task.color
View gist:3a4bb1fd01c547bacb1baf3328986ee5
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
You can’t perform that action at this time.