Skip to content

Instantly share code, notes, and snippets.

@kencoba
kencoba / JpqlExecutor.java
Last active April 9, 2020 01:29
REPL for JPQL
package client;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Scanner;
@kencoba
kencoba / KeywordColoring.vbs
Created September 11, 2015 07:10
keyword coloring for word
Public Sub キーワードカラー()
Dim keywordList() As String
keywordList = Split("abstract,continue,for,new,switch,assert,default,goto," & _
"package,synchronized,boolean,do,if,private,this,break,double,implements,protected," & _
"throw,byte,else,import,public,throws,case,enum,instanceof,return,transient," & _
"catch,extends,int,short,try,char,final,interface,static,void," & _
"class,finally,long,strictfp,volatile,const,float,native,super,while", ",")
Dim keywordColor As Long
keywordColor = RGB(128, 0, 64)
@kencoba
kencoba / InputFormula.vbs
Created September 8, 2015 12:08
セルに数式を入れる
Public Sub InputFormula()
Dim r As Range: Set r = Range(Cells(1, 6), Cells(20, 10))
Dim c As Range
Dim i As Integer: i = 101
For Each c In r
c = "=データ!A" & i
i = i + 1
Next c
End Sub
@kencoba
kencoba / データ抽出_強調表示.vbs
Last active January 27, 2020 02:12
データ抽出と強調表示を同時に行う
Option Explicit
Private Const 強調色 = 4
' | | | |cell_name1|cell_name2|...
' |directory_name|password|book_name|sheet_name|
'
@kencoba
kencoba / 強調表示.vbs
Created August 23, 2015 11:40
特定条件の行の,データが入力されているセルのみ強調表示する
Private Const 強調色 = 4
Private Const 検索開始列 = 2
Private Const 検索最終列 = 6
Private Const 検索開始行 = 2
Private Const 検索最終行 = 6
Public Sub 強調表示_1件のみ()
Dim r As Range: Set r = Range(Cells(検索開始行, 検索開始列), Cells(検索最終行, 検索開始列))
Dim c As Range
@kencoba
kencoba / データ抽出.vbs
Last active August 29, 2015 14:27
Excelシートのデータを抽出する
Option Explicit
' | | | |cell_name1|cell_name2|...
' |directory_name|book_name|sheet_name|
'
Public Sub データ抽出()
Dim ブック_オリジナル As Workbook: Set ブック_オリジナル = ThisWorkbook
Dim シート_オリジナル As Worksheet: Set シート_オリジナル = ブック_オリジナル.Sheets(1)
@kencoba
kencoba / LogFilter.java
Last active August 29, 2015 14:23
Kitsunebi: Tomcat Debug Filter
package filters;
import java.io.IOException;
import java.util.Enumeration;
import java.util.logging.Logger;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@kencoba
kencoba / quotient.scala
Created July 14, 2014 08:29
worksheet of quotient.
object quotient {
def mkCoset[E](objs: Seq[E], equivalence: (E) => E):Iterable[Seq[E]] = {
objs.groupBy(e => equivalence(e)).map(p => p._2)
} //> mkCoset: [E](objs: Seq[E], equivalence: E => E)Iterable[Seq[E]]
val coset = mkCoset((1 to 5), (e:Int) => e % 3)
//> coset : Iterable[Seq[Int]] = List(Vector(2, 5), Vector(1, 4), Vector(3))
val originalSet = coset.flatten //> originalSet : Iterable[Int] = List(2, 5, 1, 4, 3)
}
@kencoba
kencoba / Scenario3.scala
Created July 14, 2014 06:24
Third ieration : Stalls can have different charging algorithm.
package iteration.third
import java.util.Date
object Scenario3 {
def main(args: Array[String]) = {
def payMethodNormal(t: Ticket) = (t.outTime.getTime - t.inTime.getTime).toInt
def payMethodDouble(t: Ticket) = (t.outTime.getTime - t.inTime.getTime).toInt * 2
@kencoba
kencoba / Scenario2.java
Created July 10, 2014 14:53
The code after second iteration [Mame night(2014/7/10)](http://www.mamezou.com/event/mn_20140710.html)
package iteration.second;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class Scenario2 {
public static void main(String[] args) {
ParkingArea pa = new ParkingArea(2);
Parking t1 = pa.checkin(0);