Skip to content

Instantly share code, notes, and snippets.

View gouf's full-sized avatar
😇
I don't know how my life work with.

Go Furuya gouf

😇
I don't know how my life work with.
View GitHub Profile
@gouf
gouf / README.md
Last active September 30, 2016 15:16

課題概要

Problem::Array.sample_data,Problem::Json.sample_dataが生成したデータを元に、ソートをする

ただし、ソートする順番は Problem::Array.sample_data が生成する内容に従わなければならない

サンプルデータの生成内容

Problem::Array.sample_data : ソート順を決定する配列を生成する

@gouf
gouf / ofuton.rb
Created July 24, 2016 18:17
Mechanize による診断メーカーの情報取得とオストンインゲーム例
require_relative 'shindan_scrape'
module Ofuton
def self.in(user_name, hide_url: true)
result = ShindanScrape.new(362_791, user_name).shindan
if hide_url
cutoff_last_url(result)
else
result
end
@gouf
gouf / .bashrc
Created June 14, 2016 05:16
Switch git author
function switch_git_config () {
name=$1
email=$2
git config --global user.name $name
git config --global user.email $email
echo "Configuration has changed:"
echo "git config user.name: $(git config user.name)"
echo "git config user.email: $(git config user.email)"
}
@gouf
gouf / split_values_in_list_function.php
Created April 28, 2016 08:25
正規表現とlist 関数による多重代入で、日付と時刻を扱いやすい形に変換する
<?php
$now = date("Y-m-d H:i:s");
list($_year, $month, $day, $hour, $min, $sec) = preg_split('/[-: ]/', $now);
echo "${month}月${day}日"; // => 04月28日
echo "${hour}:${min}:${sec}"; // => 08:20:15
@gouf
gouf / set_variable_in_loop.php
Created April 27, 2016 04:44
クラスのインスタンス変数をループ中でセット
<?php
// your code goes here
class MyClass {
public $name;
public $age;
function MyClass(){}
}
北海道
青森県
岩手県
宮城県
秋田県
山形県
福島県
茨城県
栃木県
群馬県
# Ref : [How to create a ssh tunnel in ruby and then connect to mysql server on the remote host](http://stackoverflow.com/questions/4103809/how-to-create-a-ssh-tunnel-in-ruby-and-then-connect-to-mysql-server-on-the-remot)
require 'net/ssh/gateway' # gem install net-ssh-gateway
require 'mysql2'
host = '192.168.0.2'
user = 'root'
pass = 'root'
db = 'db_name'
port = 22
@gouf
gouf / index.html
Created April 1, 2016 14:33
selenium であそぶ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<a href="second.html" target="_blank">click</a>
<form action="#" enctype="multipart/form-data">
<input type="file">
@gouf
gouf / capybara cheat sheet
Created April 1, 2016 08:46 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@gouf
gouf / memo.md
Last active April 1, 2016 08:03
重複した項目を検出する