Skip to content

Instantly share code, notes, and snippets.

@yusukezzz
yusukezzz / homes.js
Last active December 20, 2015 08:49
homes.js
exports.replyPattern = /https?:\/\/www\.homes\.co\.jp\/([a-z0-9\-.]+)[^\s]+/;
exports.reply = function(client, nick, to, dom)
{
var items = [];
items.push(dom('dd#chk-bkc-moneyroom > span').text().trim());
var tmp = dom('dd#chk-bkc-moneyroom').text().trim().match(/\((.*?)\)/);
items.push(tmp[1].trim());
tmp = dom('dd#chk-bkc-moneyshikirei').text().trim().split('/');
items.push(tmp[1].trim());
@yusukezzz
yusukezzz / pre-commit
Last active December 30, 2015 10:49
git hook pre-commit
#!/bin/sh
REPO_ROOT="$GIT_DIR/.."
cd $REPO_ROOT
composer dump
phpunit
@yusukezzz
yusukezzz / laravel_resources.md
Last active October 27, 2016 00:05
Laravel resources
<?php namespace Yusukezzz;
use Illuminate\Filesystem\Filesystem;
class Config implements \ArrayAccess
{
/**
* @var array
*/
protected $items = [];
update
upgrade
tap homebrew/dupes
tap homebrew/php
tap caskroom/cask
install brew-cask
install android-sdk
@yusukezzz
yusukezzz / hhvm
Last active January 26, 2017 12:25
hhvm init.d script for centos
#!/bin/bash
#
# /etc/rc.d/init.d/hhvm
#
# Starts the hhvm daemon
#
# chkconfig: 345 26 74
# description: HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP
# processname: hhvm
# prefixキーをC-aに変更する
set -g prefix C-a
# C-a a で先頭に移動
bind a send-prefix
# C-bのキーバインドを解除する
unbind C-b
# キーストロークのディレイを減らす
set -sg escape-time 1
@yusukezzz
yusukezzz / Main.kt
Created January 21, 2016 07:00
RxJava retryWhen メソッドの使用例
// RetryWithDelay 使用例
fun main(args: Array<String>) {
Observable.create<String> { subscriber ->
subscriber.onNext("test")
subscriber.onError(Throwable("error occurred"))
}
.retryWhen(RetryWithDelay(3, 1000L))
// toBlocking() や Thread.sleep() 的なものがないとメインスレッドが一瞬で終了してリトライ中の処理ごと死んでしまう
// 実処理では blocking するわけに行かないので処理中に死んだ場合を考慮する必要があるかも
// -> Android なら onStop() での unsubscribe() ? 要調査
package net.yusukezzz.android.ldrviewer
import android.webkit.CookieManager
import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.HttpUrl
import java.util.*
class AndroidCookieJar(val cookieManager: CookieManager): CookieJar {
{
"content_scripts": [ {
"js": [ "newtab.js" ],
"matches": [ "*://*/*" ]
} ],
"description": "Always open external links in a new tab.",
"manifest_version": 2,
"name": "Open External Links in New Tab",
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "1.0"