Skip to content

Instantly share code, notes, and snippets.

Avatar

Takaki Hoshikawa oboenikui

View GitHub Profile
@oboenikui
oboenikui / AndroidGradleConfig.md
Created Jul 20, 2019
Change gradle config of mvnrepository.com for Android
View AndroidGradleConfig.md

JavaScript code

document.getElementById("gradle-a").value = document.getElementById("gradle-a").value
    .replace(/group: '(.*)', name: '(.*)', version: '(.*)'/, "'$1:$2:$3'")
    .replace(/Compile/, 'Implementation')
    .replace(/^compile/, 'implementation');

Bookmarklet

@oboenikui
oboenikui / gen-kotlin-jackson.js
Last active Nov 29, 2017
JSONからJackson用Kotlin data class生成
View gen-kotlin-jackson.js
function generate(obj, className, current) {
if(!current) current = ""
var keys = Object.keys(obj)
var props = keys.map(key=>[toKotlinType(obj[key], key), key])
.map(([className, variableName]) => {
if (typeof obj[variableName] == "object" && !(obj[variableName] instanceof Array))
current = travel(obj[variableName], className, current);
else if(obj[variableName] instanceof Array)
current = travel(obj[variableName][0], toUCC(variableName), current);
View vaaaaaanquish_doitsunotori.js
(()=>{
let responseImage = new Image();
responseImage.style.maxWidth = "100%";
responseImage.style.display = "block";
let canvas = document.createElement("canvas");
document.querySelector('body > form > input[type="submit"]').style.display = "none";
document.getElementById("id_image").addEventListener("change", ev=>{
let files = ev.target.files;
if (!files.length || !files[0].type.match(/^image\/(png|gif|jpeg)$/))
return;
@oboenikui
oboenikui / UnivFeliCa.md
Last active Oct 16, 2021
大学生協FeliCaの仕様
View UnivFeliCa.md

WHAT IS THIS

大学生協のFeliCa,及び諸大学の学生証一体型FeliCaの仕様
レスポンスについては,特に表記のない限り東北大学のもの (学生証一体型ではない)
断りのない限りコードはビッグエンディアンで通信する (下記のドキュメントに合わせた)
記号と区別するため,アルファベットの大文字表記は記号,小文字表記は16進表記とする

FeliCa自体の仕様については,Sony公式のドキュメントを参考に

System Code

@oboenikui
oboenikui / normalize_onair_date.txt
Last active Jul 5, 2016
放送時間表記の正規化のイメージ
View normalize_onair_date.txt
if 放送日時.時 < 4:
放送日時.日 += 1
else if 放送日時.時 >= 24:
放送日時.日 += 1
放送日時.時 -= 24
end if
View nodejs-websocket.d.ts
// Type definitions for nodejs-websocket
// Project: https://github.com/sitegui/nodejs-websocket
// Definitions by: oboenikui <https://github.com/oboenikui>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "nodejs-websocket" {
import tls = require('tls');
import net = require('net');
@oboenikui
oboenikui / Recovery.java
Created Apr 13, 2016
GitBucketのデータベースを修復するやつ
View Recovery.java
import java.io.*;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Recovery {
public static void main(String[] args) throws IOException {
BufferedReader reader1 = new BufferedReader(new InputStreamReader(new FileInputStream(new File("to.txt"))));
BufferedReader reader2 = new BufferedReader(new InputStreamReader(new FileInputStream(new File("from.txt"))));
String line = "", line1 = reader1.readLine(), line2 = reader2.readLine();
@oboenikui
oboenikui / anime.js
Created Mar 9, 2016
Wikipediaのアニメ一覧のページで正規表現に一致したアニメの名前を返す
View anime.js
/**
* Wikipediaの日本のアニメ一覧のページ(こことか http://bit.ly/1U437EE)で正規表現にマッチしたアニメタイトルを返す
*/
function animeMatcher(regexp) {
var animes = [];
$(".wikitable > tbody > tr > td:nth-child(2)").each(function(){
if(this.innerText.match(regexp)){
animes.push(this.innerText);
}
});
@oboenikui
oboenikui / hide-pictures.js
Last active Mar 22, 2016
Twitter Web Clientで画像を隠すやつ (URLマウスオーバーで表示)
View hide-pictures.js
(function() {
var style = document.createElement("style");
style.innerText = ".AdaptiveMedia{display: none !important}\n.twitter-timeline-link.u-hidden{display: block !important}";
document.head.appendChild(style);
var setMouseOver = function(selectedElements) {
var hidden;
if(selectedElements) {
hidden = selectedElements.find(".twitter-timeline-link.u-hidden");
} else {
hidden = $(".twitter-timeline-link.u-hidden");
@oboenikui
oboenikui / cookpad.js
Created Jan 30, 2016
Cookpadで材料を指定するもメニューが多すぎて選びきれないときに勝手に選んでくれるやつ
View cookpad.js
function parseQuery(query) {
var result = {};
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
result[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
}
return result;
}