Skip to content

Instantly share code, notes, and snippets.

function peco-git-checkout() {
local BRANCH=`git branch -a | peco`
if [[ -z "$BRANCH" ]]; then
return
fi
if [[ "$BRANCH" =~ remotes/([^/]*)/(.*) ]]; then
git checkout -b ${BASH_REMATCH[2]} ${BASH_REMATCH[1]}/${BASH_REMATCH[2]}
else
git checkout $BRANCH
fi
@takezoe
takezoe / open-github.sh
Created August 11, 2017 03:51
Open the browser and search GitHub repositories
open-github() {
open "https://github.com/search?q=$1+in%3Aname&type=Repositories"
}
@takezoe
takezoe / peco-sbt-new.sh
Last active August 19, 2017 07:28
Auto completion for sbt new using peco
function peco-sbt-new() {
local TEMPLATE=`curl https://github.com/foundweekends/giter8/wiki/giter8-templates -s | grep "\.g8<" | sed -e "s/</ /g" -e "s/>/ /g" | awk '{print $3}' | peco | head -n 1`
if [[ -z "$TEMPLATE" ]]; then
return
fi
sbt new $TEMPLATE
}
@takezoe
takezoe / pio-0.12.0-inclubating.md
Last active July 12, 2017 09:07
Tickets remaining in 0.12.0-incubating
@takezoe
takezoe / play2.6_highlight.md
Last active July 5, 2017 01:35
Play 2.6のハイライト

原文はこちら: https://www.playframework.com/documentation/2.6.x/Highlights26

グローバルステートが非推奨に

アプリケーションではplay.api.Play.current / play.Play.application()でグローバルアプリケーションにアクセスできるけど非推奨。以下のようにして禁止することもできる。

play.allowGlobalApplication=false
@takezoe
takezoe / CustomerServiceTest.java
Created June 25, 2017 06:36
Test case which uses @MockBean in Spring Boot application
package com.example.service;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.util.Collections;
import com.example.repository.CustomerRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@takezoe
takezoe / scalatra26.md
Last active June 8, 2017 09:39
[Draft]The plan of Scalatra 2.6.0

[Draft]Plan for Scalatra 2.6.0

The main goal of Scalatra 2.6.x is to decrease future maintenance efforts and costs, since there are not enough active committers to maintain the existing huge codebase. To achieve this goal, I propose the followings:

  • Follow the Scala standards (e.g. Twirl instead of Scalate, ScalaTest instead of Specs2)
  • Deprecate modules that are not used much or not maintained enough

More specific tasks:

Overall

@takezoe
takezoe / SprayJsonSupport.scala
Created May 21, 2017 12:35
spray-json Java support
package akka.stream.alpakka.elasticsearch.javadsl
import spray.json._
import scala.collection.mutable
/**
* Helpers to use spray-json in Java.
*/
object SprayJsonSupport {
@takezoe
takezoe / 2017-06-01-scalatra-2-5-1-released.md
Last active June 6, 2017 06:51
[Draft]Scalatra 2.5.1 is out
title layout author twitter date
Scalatra 2.5.1 is out
news
Naoki Takezoe
takezoen
2017-06-01

The Scalatra team is pleased to announce the release of version 2.5.1 of the framework. This is a maintenance release which fixes some Swagger2 support bugs in 2.5.0.

HelloWorld
HelloWorld
HelloWorld