Skip to content

Instantly share code, notes, and snippets.

View tanjo's full-sized avatar
🌐
https://twitter.com/tanjoin

Yuuki Tanjo tanjo

🌐
https://twitter.com/tanjoin
View GitHub Profile
@tanjo
tanjo / index.html
Created March 23, 2016 08:15
目次自動生成スクリプト
<!DOCTYPE html>
<html>
<head>
<title>mokuji</title>
<link rel="stylesheet" href="styles.css">
</head>
<body onload="createMokuji(2,4)">

QuickTime Player とかで画面キャプチャしたあとに gif にしたい場合

ffmpeg -i input.mov -an -r 15 -pix_fmt rgb24 -f gif -vf scale=640:-1 out.gif

これでいい感じの gif になる

@tanjo
tanjo / README.md
Last active September 13, 2017 06:42
RxBus をシンプルに

RxBus をちょびっとシンプルに書く

ベースはここ

違うところ

趣味の領域だが、subscribe に以下の処理を入れたり、 filtero -> o instanceof SomeEventmapo -> (SomeEvent) o) を記載するとダサいのでスマートに書く

@tanjo
tanjo / BaseApi.java
Created September 13, 2017 08:51
Retrofit 2 の interface を同一ファイルに書く
package in.tanjo.retrofit.api;
import retrofit2.Retrofit;
class BaseApi<T> {
T service;
public BaseApi(Class<T> tClass) {
this.service = RetrofitUtil.getInstance().create(tClass);
@tanjo
tanjo / Jsonable.swift
Created January 17, 2018 11:27
Jsonable のススメ
//
// 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
@tanjo
tanjo / README.md
Created February 5, 2018 10:28
UIGestureRecognizerState の rawValue

UIGestureRecognizerState の rawValue について

一覧

  • possible 0
  • began 1
  • changed 2
  • ended 3
  • cancelled 4
  • failed 5
@tanjo
tanjo / keydown.js
Created April 19, 2018 09:02
ショートカットの Command + ↓ が効かなかったときに試したコード
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));
}
@tanjo
tanjo / tea.js
Created May 11, 2018 05:28
Botkit で使えるお茶リアクション
module.exports = function(controller) {
controller.hears(['茶', 'tea', 'おちゃ', 'りょくちゃ', '🍵', '旦', 'Tea'], ['ambient'], function(bot, message) {
bot.api.reactions.add({
timestamp: message.ts,
channel: message.channel,
name: 'tea'
});
});
};
@tanjo
tanjo / gist:f3dde96c5d2610d3ca6cf1d4093e36f9
Last active September 28, 2018 09:08
ブラウザの座標を表示する
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);
@tanjo
tanjo / main.js
Last active January 21, 2019 08:03
puppeteer で画像をダウンロード
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');