Skip to content

Instantly share code, notes, and snippets.

View jmatsu's full-sized avatar
🏠
Working from home

Jumpei Matsuda jmatsu

🏠
Working from home
View GitHub Profile
object BookmarkTranslator {
  fun toPresentation(model: Bookmark): BookmarkViewModel {
    return BookmarkViewModel().build(model.id.value) {
      name = model.name
      // ommit
    }
  }
  
 fun toDomainId(viewModel: BookmarkViewModel): Bookmark.Id = Bookmark.Id(viewModel.id.key)
atom-dark-ui-slim
autocomplete-paths
autocomplete-sass
color-picker
highlight-selected
jumpy
maximize-panes
merge-conflicts
minimap
minimap-autohide
@jmatsu
jmatsu / gist:10add47e76a48b1ecebe
Created March 16, 2016 17:50
android test coverage
http://chrisjenx.com/gradle-robolectric-jacoco-dagger/
@jmatsu
jmatsu / Failure__NoSetter.java
Last active March 5, 2016 16:02
Orma with Kotlin data class
@Table
data class AuthorizedUser(
@Column
val ok: Boolean,
@Column
val url: String,
@Column
val team: String,

sbt

Output 'sbt test-only' with appropreate classes.

sbt_test_only () {
	[[ $# -eq 0 ]] && return 1
	local classes=$(git log --name-only --oneline $1..HEAD|grep "^test"|sort|uniq|while read line; do echo "$(head -1 $line|awk '$0=$2').$(cat $line|grep "object"|awk '$0=$2')"; done|xargs)  
	echo "sbt \"test-only $classes\""
}
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
class IntRestrictedProperty(minValue : Int, maxValue : Int, private var curValue:Int = 0) : ReadWriteProperty<Any?, Int> {
val valueRange = IntRange(minValue, maxValue)
override fun getValue(thisRef: Any?, prop: KProperty<*>): Int = curValue
override fun setValue(thisRef: Any?, prop: KProperty<*>, value: Int) {
curValue = valueRange.clamp(value)
@jmatsu
jmatsu / nemoto.sh
Last active December 19, 2015 15:53
git rev-list --left-right $(git rev-parse --abbrev-ref HEAD)...$(git rev-parse --abbrev-ref $(git rev-parse --abbrev-ref HEAD)@{upstream})|tail -1|sed 's/^<//'
current_branch=$(git rev-parse --abbrev-ref HEAD)
tracked_branch=$(git rev-parse --abbrev-ref ${current_branch}@{upstream})
git rev-list --left-right ${current_branch}...${tracked_branch}|tail -1|sed 's/^<//'
@jmatsu
jmatsu / git.md
Last active November 11, 2015 14:46
便利なやつ for MacOSX

git rev-list HEAD --count

docx, pptx とか

Apacheのtika を入れて,/usr/local/bin/parsexml を作って

/usr/local/bin/parsexml

#!/usr/bin/env bash
tika -t "$1"
@jmatsu
jmatsu / TODO
Last active September 25, 2015 12:05
Contents can't be empty.