Skip to content

Instantly share code, notes, and snippets.

View yuta0801's full-sized avatar

yuta yuta0801

View GitHub Profile
// ==UserScript==
// @name 他人のScrapboxプロジェクトにUserCSSを適応する
// @namespace https://scrapbox.io/yuta0801/他人のScrapboxプロジェクトにUserCSSを適応する
// @version 0.2
// @description 他人のScrapboxプロジェクトにUserCSSを適応する
// @author yuta0801
// @match https://scrapbox.io/*/*
// @grant unsafeWindow
// ==/UserScript==
((input, log) => (
(def => (
def({
split: (target => input => (
def({
length: (input => (
def((fn, [char, ...text], i) => (
char ? fn(fn, text, i + 1) : i
), fn => fn(fn, input, 0))
)),
@yuta0801
yuta0801 / complement-discord.js-stacktrace.js
Created May 2, 2020 20:00
Complement stack trace of DiscordAPIError in Discord.js
const Discord = require('discord.js')
const client = new Discord.Client()
{
const prototype = Object.getPrototypeOf(client.rest)
const original = Object.getOwnPropertyDescriptor(prototype, 'api').get
Object.defineProperty(prototype, 'api', {
get() {
const builder = original.apply(this)
@yuta0801
yuta0801 / p2p.plantuml
Created April 7, 2020 04:45
Piping Server上でP2P通信をするときの流れ
@startuml p2p
group クライアント数だけ繰り返す
Uploader -> Server : /:randomにtokenを生成してPOST
Uploader --> Downloader : /:randomを教える
Downloader -> Server : /:randomをGETし:tokenを取得
group ファイル数分繰り返す
Uploader -> Server : /:random/:tokenをGET
Downloader -> Server : /:random/:tokenに欲しいfileをPOST
Downloader -> Server : /:random/:token/:fileをGET
function getXpath(element) {
if(!element || !element.parentNode) return ''
let xpath = getXpath(element.parentNode) + '/' + element.tagName
const elements = []
for(const e of element.parentNode.childNodes) {
if(e.tagName == element.tagName) elements.push(e)
}
if(1 < elements.length) {
const i = elements.indexOf(element)
xpath += '[' + (i+1) + ']'
@yuta0801
yuta0801 / tagsta.sh
Created December 26, 2019 17:11
Tagging commit like stash/a2c2b7d/0
HASH=$(git rev-parse --short HEAD)
PREFIX="stash/$HASH"
function exist() {
git rev-parse $1 >/dev/null 2>&1
}
for i in {0..9}; do
if exist "$PREFIX/$i"; then
continue
@yuta0801
yuta0801 / .hyper.js
Last active December 8, 2019 22:30
My Hyper config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
🗣 Commented on #7 in yuta0801/scrapbox-reader
🎉 Merged PR #5 in yuta0801/scrapbox-reader
🎉 Merged PR #6 in yuta0801/scrapbox-reader
🗣 Commented on #5 in yuta0801/scrapbox-reader
🎉 Merged PR #4 in yuta0801/scrapbox-reader
TypeScript 1 min █████████████████████ 100.0%
function nativeApLoginStart() {
const [d, a] = installVersionCheck(false)
if (d && a) return
const dialogMap = {
Win: {
IE: '#ieInstallDialog',
Edge: '#edgeInstallDialog',
Chrome: '#chromeInstallDialog',