- possible 0
- began 1
- changed 2
- ended 3
- cancelled 4
- failed 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIStoryboard { | |
static func mainInstantiate<T>(withViewController type: T.Type) -> T where T: UIViewController { | |
let storyboard = UIStoryboard(name: "Main", bundle: nil) | |
guard let controller = storyboard.instantiateViewController(withIdentifier: type.storyboardIdentifier) as? T else { | |
fatalError("Could not instantiate view controller with type \(T.self)") | |
} | |
return controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
["rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)", "rgb(0, 1, 2)"] | |
.map((e) => "#" + e.style.borderTopColor | |
.replace(/rgb/g, '') | |
.replace(/\(/g,'') | |
.replace(/\)/g,'') | |
.replace(/ /g,'') | |
.split(',') | |
.map((e) => ("0" + parseInt(e).toString(16)).slice(-2)) | |
.join('')) | |
.join(" "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs').promises; | |
const puppeteer = require('puppeteer'); | |
const headleass = true; | |
(async () => { | |
var browser = await puppeteer.launch({ headless: headleass, args: ['--lang=ja,en-US,en'] }); | |
var page = await browser.newPage(); | |
page.setViewport({ width: 1920, height: 1080 }); | |
// 自分のツイッターのアイコン | |
var source = await page.goto('https://pbs.twimg.com/profile_images/450452672638763008/2wm_mrCJ.jpeg'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var div = document.createElement('div'); | |
div.id = "tj-pos-view"; | |
div.style.cssText = "position: fixed; right: 0; top: 0; background: black; color: white;" | |
document.body.appendChild(div); | |
document.body.addEventListener("mousemove", (e) => document.getElementById("tj-pos-view").innerText = "x: " + e.pageX + " y: " + e.pageY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(controller) { | |
controller.hears(['茶', 'tea', 'おちゃ', 'りょくちゃ', '🍵', '旦', 'Tea'], ['ambient'], function(bot, message) { | |
bot.api.reactions.add({ | |
timestamp: message.ts, | |
channel: message.channel, | |
name: 'tea' | |
}); | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.onkeydown = function(e) { | |
if((e.ctrlKey && !e.metaKey) || (!e.ctrlKey && e.metaKey)) { | |
if (e.keyCode === 40) { | |
window.scrollTo(0,document.body.scrollHeight); | |
} | |
} | |
console.log(JSON.stringify(e.keyCode)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Jsonable.swift | |
// | |
// MIT License | |
// | |
// Copyright (c) 2018 tanjo | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package in.tanjo.retrofit.api; | |
import retrofit2.Retrofit; | |
class BaseApi<T> { | |
T service; | |
public BaseApi(Class<T> tClass) { | |
this.service = RetrofitUtil.getInstance().create(tClass); |
ベースはここ
趣味の領域だが、subscribe
に以下の処理を入れたり、 filter
に o -> o instanceof SomeEvent
や map
に o -> (SomeEvent) o)
を記載するとダサいのでスマートに書く
NewerOlder