This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 久々に触ったJavaでこういうことをやってしまったと言う話 | |
| public final class MyClassOne{ | |
| private static final ArrayList<String> myList = new ArrayList<String>() | |
| //-------^これがミス | |
| public MyClassOne add(String str){ | |
| myList.add(str) | |
| return this | |
| } | |
| public int size(){ | |
| myList.size() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // はたと困ったのでテスト | |
| // T[] arr=ArrayList<T>.toArray(T[]) | |
| // で得られた配列arrをいじくるとどうなるんだったっけ? | |
| // 予想では引数として与えた配列へ値がコピーされ、 | |
| // 返却値は配列への参照となっているハズ。 | |
| ArrayList<String> alist = new ArrayList<String>() | |
| alist.add(0,'文字列1') | |
| alist.add(0,'文字列2') | |
| alist.add(0,'文字列3') | |
| assert(alist.get(0)=='文字列3') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>サンプル</title> | |
| <script src="./meter.js"></script> | |
| </head> | |
| <body> | |
| <p>180pxくらいの大きさで80%のメーターを表示する。</p> | |
| <div id="meter"></div> | |
| <script> | |
| var _id = 'meter'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Minimal build.gradle for Lift project | |
| apply { | |
| plugin 'scala' | |
| plugin 'war' | |
| plugin 'jetty' | |
| plugin 'eclipse' | |
| } | |
| scalaVersion = '2.9.2' | |
| liftVersion = '2.5-M4' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| SSH_CONFIG="$HOME/.ssh/config" | |
| SSH_ENV="$HOME/.ssh/environment" | |
| # start the ssh-agent | |
| function start_agent { | |
| echo "Initializing new SSH agent..." | |
| # spawn ssh-agent | |
| ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find . -type f | grep -v ".git/" | xargs -Ixx file -i -N xx | sed -e 's/.\+\([\/\.][^\/^\.]\+\+\):/\1/g' |sort -u > .gitattributes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C:\>echo %path% | perl -nle "s/;/;\n/g;print $_" | |
| C:\Program Files (x86)\Haskell\bin; | |
| C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\extralibs\bin; | |
| C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin; | |
| C:\Program Files (x86)\Intel\iCLS Client\; | |
| C:\Program Files\Intel\iCLS Client\; | |
| %SystemRoot%\system32; | |
| %SystemRoot%; | |
| %SystemRoot%\System32\Wbem; | |
| %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List.metaClass.toString = { squate,equate=null -> | |
| if(equate==null) equate = squate | |
| delegate.collect {"${squate}${it}${equate}"} | |
| } | |
| def l = ["a","b","c"]; | |
| println l.toString() | |
| println l.toString("'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def getSteps = {start=1,max,step=1000 -> | |
| if(max <= start + step) return [[start..max]] | |
| def rs = (start..max).step(step).inject([]) {a,c -> (c>start) && a << [ ((a!=[])?a.last().to[0]+1:start)..c-1];a} | |
| (rs.last().to[0] != max) && rs << [rs.last().to[0]+1..max];rs | |
| } | |
| println""" | |
| getSteps(max=10020) = ${getSteps(max=10020)} | |
| """ | |
| println""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.regex.Matcher | |
| import java.util.regex.Pattern | |
| def stopWatch = {c-> | |
| s = System.nanoTime() | |
| c() | |
| "${(System.nanoTime() - s) / 1000} [microsec]" | |
| } | |
| Pattern slowp = Pattern.compile(/[^。「」]{30,}/) |