Skip to content

Instantly share code, notes, and snippets.

@geerpm
geerpm / tampermonkey-trello-copy2clipboard.js
Created September 20, 2022 07:45
If you click trello card's title icon, then copied cardNo, title and url to the clipboard
// ==UserScript==
// @name trello/title,url,cardNo copy to clipboard
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author geerpm
// @match https://trello.com/c/*
// @grant none
// ==/UserScript==
//ooo
foreach ($_REQUEST as $k => $v) {
if (!is_scalar($k)) $k = json_encode($k);
if (!is_scalar($v)) $v = json_encode($v);
file_put_contents("php://stderr", "[{$k}] {$v}" . PHP_EOL);
}
abort(401, 'Unauthorized');
@geerpm
geerpm / file0.sh
Last active November 21, 2018 07:12
SSRをやめる。OGP対応はLambda@Edgeでダイナミックレンダリングする。 ref: https://qiita.com/geerpm/items/78e2b85dca3cb698e98d
$ npm i -g vue-cli
$ vue create test-project
Vue CLI v3.1.3
? Please pick a preset: Manually select features
? Check the features needed for your project: Babel, TS, PWA, Router, Vuex, CSS Pre-processors, Linter
? Use class-style component syntax? Yes
? Use Babel alongside TypeScript for auto-detected polyfills? Yes
? Use history mode for router? (Requires proper server setup for index fallback in production) Yes
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Sass/SCSS
@geerpm
geerpm / UserAgentComponent.php
Created September 20, 2018 06:41
cakephp component parsing user agent params
<?php
/**
* UserAgent判定
*
* UAリスト
* http://www.openspc2.org/userAgent/
* http://www.useragentstring.com/pages/useragentstring.php
*
*
* android標準ブラウザUA
@geerpm
geerpm / FAButton.swift
Last active August 31, 2018 11:31
FAB with minimizing written by swift
//
// FAButton.swift
//
//
import UIKit
// Floating Action Button
// FAB要件
@geerpm
geerpm / VButton.swift
Created August 24, 2018 10:00
UIButton aligned image and text vertically. swift4
//
// VButton.swift
//
// Image and title align vertically and horizontal center dynamically.
// Recommends to set font for titleLabel
//
// Use this answer https://stackoverflow.com/a/17604681
// Rewriting for Swift4
//
@geerpm
geerpm / JPPrefs.php
Created June 28, 2018 03:48
PHP 日本の都道府県マスタ
$prefList = [
['kanji' => '北海道', 'kana' => 'ホッカイドウ', 'alphabet' => 'Hokkaido'],
['kanji' => '青森県', 'kana' => 'アオモリケン', 'alphabet' => 'Aomori'],
['kanji' => '岩手県', 'kana' => 'イワテケン', 'alphabet' => 'Iwate'],
['kanji' => '宮城県', 'kana' => 'ミヤギケン', 'alphabet' => 'Miyagi'],
['kanji' => '秋田県', 'kana' => 'アキタケン', 'alphabet' => 'Akita'],
['kanji' => '山形県', 'kana' => 'ヤマガタケン', 'alphabet' => 'Yamagata'],
['kanji' => '福島県', 'kana' => 'フクシマケン', 'alphabet' => 'Fukushima'],
['kanji' => '茨城県', 'kana' => 'イバラキケン', 'alphabet' => 'Ibaraki'],
['kanji' => '栃木県', 'kana' => 'トチギケン', 'alphabet' => 'Tochigi'],
@geerpm
geerpm / PsrSimpleCache.php
Created May 16, 2018 11:10
cakephp3.6 PSR-16(simple cache) adapter with \Cake\Cache\Cache (NO DEBUG)
<?php
/**
* cakephp3.6
* Cache adapter for PSR-16
*
* 1. Add 'psr/simple-cache' to your composer ($ composer.phar require psr/simple-cache)
* 2. Add 'psr16' settings in app.php OR change 'CACHE_ENGINE' constant in PsrSimpleCache class.
*
* 'Cache' => [
* 'psr16' => [
@geerpm
geerpm / file0.txt
Created November 16, 2017 09:17
Cakephp3 migrations plugin (Phinx) を既存の環境に導入する ref: https://qiita.com/geerpm/items/f28a3dbf5aa744eb0ba7
# dump例
mysqldump --no-data [db] -h [host] -u [user] > config/Migrations/initial.sql
@geerpm
geerpm / file0.php
Last active November 17, 2017 05:52
Cakephp3のTestでメールを送りたくない ref: https://qiita.com/geerpm/items/ffd1342f7a21571c37a2
class HogeTest extends IntegrationTestCase
{
public function setUp()
{
parent::setUp();
// 一度dropしないと設定できない
// config/app.phpでEmailやEmailTransportの設定を確認して使用中のものを引数で渡す
\Cake\Mailer\Email::dropTransport('default');