Problem::Array.sample_data
,Problem::Json.sample_data
が生成したデータを元に、ソートをする
ただし、ソートする順番は Problem::Array.sample_data
が生成する内容に従わなければならない
Problem::Array.sample_data
: ソート順を決定する配列を生成する
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 |
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)" | |
} |
<?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 |
<?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 |
<!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"> |
=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') |
a = ["A", "B", "C", "B", "A"]
a.detect{ |e| a.count(e) > 1 } # => ['A', 'B']
Ruby: How to find and return a duplicate value in array? - stackoverflow