Skip to content

Instantly share code, notes, and snippets.

// https://tumoiyorozu.github.io/white200/
// 「スタート」「本番開始」ボタンを押したあと、 F12 で開発者ツール開いて以下を貼り付けてEnterでおk
const questionText = document.querySelector('#problem_text').innerText;
const colorText = questionText.match(/#([a-z0-9]{6})/)[1];
const rText = colorText.substr(0, 2);
const gText = colorText.substr(2, 2);
const bText = colorText.substr(4, 2);
const r = Number.parseInt(rText, 16);
const g = Number.parseInt(gText, 16);
const b = Number.parseInt(bText, 16);
task showClassPaths(type: Exec) {
def classFiles = []
configurations.compileClasspath.each { classFiles.add(it.toString()) }
def classPaths = classFiles.collect { "--class-path ${it}" }.join(" ")
executable "bash"
args "-c", "echo 'jshell ${classPaths}'"
}
@nawada
nawada / get_five_words.rb
Created February 9, 2022 11:22
Wordle用補助ツール
in_file_path = '/usr/share/dict/web2'
files = []
Dir.glob(in_file_path) do |file|
files.push(file)
end
five_char_words = []
File.open(in_file_path) do |file|
file.each_line do |line|
@nawada
nawada / index.html
Last active December 27, 2021 14:42
チーム分けするやつ
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Team Switcher</title>
<style>
#teams {
display: flex;
justify-content: space-evenly;
@nawada
nawada / Gemfile
Created December 8, 2020 16:10
Textareaの改行コードを確認するやつ
gem 'sinatra', '~> 2.1'
@echo off
chcp 65001
set DATE=%date:~0,4%%date:~5,2%%date:~8,2%
echo コピー中...
xcopy /S /I /H /R /Y /Q %APPDATA%\7DaysToDie .\7DaysToDie__%DATE%
var newUrl=new URL(location);
newUrl.hash=`:~:text=${encodeURIComponent(getSelection().toString())}`;
var input=document.createElement('input');
input.value=newUrl;
document.querySelector('body').appendChild(input);
input.select();
document.execCommand('copy');
input.remove();
@nawada
nawada / hateb.js
Created April 2, 2020 03:50
はてなブックマークのコメントページを表示するブックマークレットです。
javascript:var _s=location.protocol==='https:'?'s/':'';var _url=`https://b.hatena.ne.jp/entry/${_s}${location.host}${location.pathname}`;var _a=document.createElement('a');_a.href=_url;_a.target='_blank';_a.rel='nofollow';_a.click();
@nawada
nawada / counting_tweet_search_result.js
Created September 12, 2019 09:47
Twitterの検索結果の件数数えるやつ
javascript:var height=window.innerHeight,rootElement=document.querySelector("div[data-testid=primaryColumn] section[role=region] > div > div > div"),times={};let intervalId=setInterval(()=>{window.scrollBy(0,height);var e=rootElement.style.paddingBottom,t=e.length;if(0===parseInt(e.substring(0,t-2)))return clearInterval(intervalId),void alert(Object.keys(times).length);document.querySelectorAll("article time").forEach(e=>times[e.dateTime]=!0)},350);
/*****
var height = window.innerHeight;
var rootElement = document.querySelector('div[data-testid=primaryColumn] section[role=region] > div > div > div');
var times = {};
let intervalId = setInterval(() => {
window.scrollBy(0, height)
var paddingBottom = rootElement.style.paddingBottom;
var paddingBottomLength = paddingBottom.length;
var rest = parseInt(paddingBottom.substring(0, paddingBottomLength - 2));
@nawada
nawada / suuumo.js
Created September 5, 2019 04:17
suumoの検索結果で情報を取得するJSスニペット
// 値段
const jpnPrices = document.querySelectorAll('.cassetteitem_price--rent');
// 管理費
const jpnAdminPrices = document.querySelectorAll('.cassetteitem_price--administration');
// 間取り
const madoris = document.querySelectorAll('.cassetteitem_madori');
// 専有面積
const floorSpaces = document.querySelectorAll('.cassetteitem_menseki');
for(let i = 0; i < jpnPrices.length; i++) {