Skip to content

Instantly share code, notes, and snippets.

View nobeans's full-sized avatar

Yasuharu Nakano nobeans

  • Yokohama, Japan
View GitHub Profile
@nobeans
nobeans / cli-support.js
Last active August 29, 2015 10:05
JavaScript to create a command line of CLI at Spring Initializr site (https://start.spring.io/ )
var groupId = document.getElementById('groupId').value;
var artifactId = document.getElementById('artifactId').value;
var name = document.getElementById('name').value;
var description = document.getElementById('description').value;
var packageName = document.getElementById('packageName').value;
var type = document.getElementById('type').value;
var packaging = document.getElementById('packaging').value;
var javaVersion = document.getElementById('javaVersion').value;
var language = document.getElementById('language').value;
var bootVersion = document.getElementById('bootVersion').value;
// helper
def shouldFail(Class klass, Closure clos) {
try {
clos.call()
} catch (Throwable e) {
assert e.class == klass : "expected: ${klass.name}, but actual: ${e.class.name}"
return
}
assert false : "expected: ${klass.name}, but nothing thrown"
}
@nobeans
nobeans / arrangeLesson.groovy
Last active August 29, 2015 14:01
第21回オフラインリアルタイムどう書く:「レッスンは何曜日?」 (http://qiita.com/torazuka/items/cbdb6b581a57e4754dd4)
def arrange(input) {
def requests = input.split(/\|/).toList()
def result = [:].withDefault { [] }
(0..<5).each { index ->
requests.clone().each { request ->
def (student, preferences) = request.split("_")
def day = preferences[index]
if (result[day].size() < 4) {
result[day] << student.toInteger()
requests.remove(request)
http://tech-gym.com/2012/07/%E6%9C%AA%E5%88%86%E9%A1%9E/786.html
1234567 x
1 lhikoav
2 rqsczlp
3 uqalnfo
4 tykajeh
5 ahitsyd
6 efoptxn
7 ruzwyve
#!/usr/bin/env bash
#>*******************************************************
# THIS FILE WAS AUTO-GENERATED BY ATLASSIAN STASH.
# DO NOT MODIFY UNDER ANY CIRCUMSTANCE.
#>*******************************************************
#
# Firing a job on Jenkins
#
read oldrev newrev refname
@Grab('net.htmlparser.jericho:jericho-html:3.3')
import net.htmlparser.jericho.*;
// http://www.javaroad.jp/servletjsp/sj_jsp1.htm
Source source = new Source("""
<HTML>
<BODY>
<%-- (1)pageディレクティブでJSPプログラムの特性を定義 --%>
<%@ page language="java"
contentType="text/html; charset=Windows-31J" %>
@nobeans
nobeans / vim-regex.md
Last active August 29, 2015 14:01
vim正規表現メモ
class Fibonacci {
def calc = { n ->
return (n == 0) ? 0 :
(n == 1) ? 1 :
call(n - 1) + call(n - 2)
}
static void main(String[] args) {
def num = args[0] as int
println "Fib($num) = ${new Fibonacci().calc(num)}"
#!/bin/bash
# Constant
GPIO_DIR=/sys/class/gpio
SWITCH_GPIO_NUM=24
LED_GPIO_NUM=25
# Tear down for previous
echo $SWITCH_GPIO_NUM > $GPIO_DIR/unexport
echo $LED_GPIO_NUM > $GPIO_DIR/unexport
@nobeans
nobeans / gist:b3b79375e31cb03fafcc
Last active August 29, 2015 14:04
JGGUG SpringBootハンズオンメモ at 2014-08-01

SpringBootハンズオンメモ

http://www.slideshare.net/makingx/grails-30-spring-boot

$ java -jar target/jggug-helloworld-1.0.0-SNAPSHOT.jar --spring.config.name=config`

とやることで同一ディレクトリのconfig.propertiesを一括で読み込める。 アプリケーションプロセスのロール?ごとにファイルを用意すれば良さそう。