This file contains hidden or 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
local keymap = { | |
q = { default = "so", shift = "la", side = "left" }, | |
w = { default = "ko", shift = "hi", side = "left" }, | |
e = { default = "si", shift = "ho", side = "left" }, | |
r = { default = "te", shift = "hu", side = "left" }, | |
t = { default = "lyo", shift = "me", side = "left" }, | |
a = { default = "ha", shift = "li", side = "left" }, | |
s = { default = "ka", shift = "wo", side = "left" }, | |
d = { default = "", shift = "ra", side = "left" }, |
This file contains hidden or 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
require 'rexml/document' | |
include REXML | |
# --- 設定 --- | |
TARGET_LENGTH = 5 | |
SOURCE_FILE = "word2jp.xml" | |
OUTPUT_FILE = "word2jp_len#{TARGET_LENGTH}.xml" | |
SIGNATURE = "word2-len#{TARGET_LENGTH}" | |
# ------------ |
This file contains hidden or 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
-- 対応するクエリ一覧 | |
-- select句(優先度: 3) | |
--- 全カラムのselect | |
select * from `articles` where `id` = 1\G | |
--- カラムを指定するselect | |
select `article_id` from `articles` inner join `article_tag` on `articles`.`id` = `article_tag`.`article_id` where `article_tag`.`tag_id` = 2 order by `created_at` desc\G | |
--- 集約関数のselect(selectRaw?) |
This file contains hidden or 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
-- select * from `migrations` where `migration` = '2017_04_27_200850_create_follows_table'\G | |
-- select * from `migrations` where `batch` = 1 order by `migration` desc\G | |
-- select * from information_schema.tables where table_schema = 'realworld_test' and table_name = 'migrations'\G | |
-- select `migration` from `migrations` order by `batch` asc, `migration` asc\G | |
select `slug` = 'new-title', `title` = 'new title', `description` = 'new description', `body` = 'new body with random text', `updated_at` = '2021-08-25 12:22:27' from `articles` where `id` = 1\G | |
select `username` = 'test12345', `email` = 'test12345@test.com', `password` = 'test12345', `bio` = 'hello', `image` = 'http://test.com/test.jpg', `updated_at` = '2021-08-25 12:22:40' from `users` where `id` = 1\G | |
select * from `articles` where `id` = 1\G | |
select * from `comments` where `id` = 1\G | |
select * from `favorites` where `user_id` = 2 and `article_id` in (1)\G | |
select * from `follows` where `follower_id` = 1 and `followed_id` in (2)\G |
This file contains hidden or 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 DisjointSetUnion | |
def initialize(size) | |
@nodes = Array.new(size) { |i| TreeNode.new(i) } | |
end | |
def unite(i, j) | |
@nodes[i].unite(@nodes[j]) | |
end | |
def same_group?(i, j) |
This file contains hidden or 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
def solve | |
n, m, g = gets.split(' ').map(&:to_i) | |
graph = Array.new(n) { Array.new } | |
m.times do | |
a, b = gets.split(' ').map(&:to_i) | |
graph[b - 1] << a - 1 | |
end | |
visited = Array.new(n, false) | |
dfs = ->(crt) do |