Skip to content

Instantly share code, notes, and snippets.

@yusukezzz
yusukezzz / Jte.kt
Created May 24, 2021 16:02
Jte feature for ktor
package net.yusukezzz
import gg.jte.CodeResolver
import gg.jte.TemplateEngine
import gg.jte.output.WriterOutput
import gg.jte.resolve.DirectoryCodeResolver
import io.ktor.application.*
import io.ktor.http.*
import io.ktor.http.content.*
import io.ktor.response.*
@yusukezzz
yusukezzz / CircleTransformation.kt
Created October 4, 2016 04:26
Picasso circle transformation by kotlin
import android.graphics.*
import com.squareup.picasso.Transformation
// https://gist.github.com/codezjx/b8a99374385a0210edb9192bced516a3
class CircleTransformation: Transformation {
companion object {
private val KEY = "circleImageTransformation"
}
override fun transform(source: Bitmap): Bitmap {
{
"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"
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 {
@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() ? 要調査
# 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 / 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
update
upgrade
tap homebrew/dupes
tap homebrew/php
tap caskroom/cask
install brew-cask
install android-sdk
<?php namespace Yusukezzz;
use Illuminate\Filesystem\Filesystem;
class Config implements \ArrayAccess
{
/**
* @var array
*/
protected $items = [];
@yusukezzz
yusukezzz / laravel_resources.md
Last active October 27, 2016 00:05
Laravel resources