Skip to content

Instantly share code, notes, and snippets.

View hosopy's full-sized avatar
🎯
Focusing

Keishi HOSOBA hosopy

🎯
Focusing
View GitHub Profile
@hosopy
hosopy / file0.groovy
Created September 14, 2017 21:13
ActionCableのKotlinクライアントを実装してみた ref: http://qiita.com/hosopy/items/46f738a65c5234c2b56c
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.hosopy:actioncable-client-kotlin:0.0.1'
}
@hosopy
hosopy / file0.txt
Created September 12, 2017 03:06
KotlinのコルーチンでFIFOな直列処理キューを実装 ref: http://qiita.com/hosopy/items/7d8c10d87f5d6eeb59f2
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.Channel
class SerializedOperationQueue(name: String = "EventLoop", capacity: Int = 0) {
private val singleThreadContext = newSingleThreadContext(name)
private val queue = Channel<suspend () -> Unit>(capacity).also {
launch(singleThreadContext) {
for (operation in it) {
operation.invoke()
}
@hosopy
hosopy / ActiveJobのジョブ
Last active August 5, 2017 11:57
SidekiqはRedisに何を書き込んでいるのか ref: http://qiita.com/hosopy/items/d2c87b6489991091ddab
{
"class": "ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper",
"wrapped": "SleepJob",
"queue": "default",
"args": [
{
"job_class": "SleepJob",
"job_id": "49f612ef-233a-4660-b9e7-cc48a80ee7d4",
"provider_job_id": null,
"queue_name": "default",
@hosopy
hosopy / HelloWorldViewController.swift
Last active November 6, 2016 18:02
XCode(Swift) + CocoapodsでgRPCのClientを生成してServiceを呼び出すまでの流れ ref: http://qiita.com/hosopy/items/957af2887e73923305df
import Foundation
import UIKit
import RemoteClient
class HelloWorldViewController: UIViewController {
...
@IBAction func requestButtonPressed(sender: UIButton) {
// For debug
// 非SSLでの接続には必要
@hosopy
hosopy / clean_old_s3_objects.sh
Created July 16, 2016 03:29
Clean old s3 objects.
#!/bin/bash
# Set your credentials if you want to configure locally.
#export AWS_ACCESS_KEY_ID=PUT_YOUR_ACCESS_KEY
#export AWS_SECRET_ACCESS_KEY=PUT_YOUR_SECRET_ACCESS_KEY
#export AWS_DEFAULT_REGION=ap-northeast-1
S3_BUCKET=PUT_YOUR_BACKET_NAME
NUM_TO_KEEP_BACKUP=7
@hosopy
hosopy / GitHubService.java
Last active April 11, 2016 02:58
OkHttpのMockWebServerをJUnitで利用する ref: http://qiita.com/hosopy/items/0af2565a4abd899f4c38
public interface GitHubService {
/**
* 指定されたユーザのリポジトリリストを取得.
*
* @param user
* @reeturn Call<List<Repository>>
*/
@GET("/users/{user}/repos")
Call<List<Repository>> listRepos(@Path("user") String user);
}
@hosopy
hosopy / @マイグレーション環境
Last active November 6, 2015 03:20
GitLab 5.3から7.13へのアップグレード作業ログ ref: http://qiita.com/hosopy/items/965a34d59a0d46731f7c
$ cd /home/git/gitlab
$ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
@hosopy
hosopy / Item.java
Created May 16, 2015 08:57
Realmの隠れた重要ポイント ref: http://qiita.com/hosopy/items/301b7c135e85c73ddc09
class Item extends RealmObject {
...
private RealmList<Comments> comments;
...
public RealmList<Comments> getComments() {
return comments;
}
public void setComments(RealmList<Comments> comments) {