This file contains 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
host:example.com url:/api/users status:200 time:2018-01-01T00:00:00+09:00 | |
host:example.com url:/api/users status:200 time:2018-01-01T00:00:01+09:00 |
This file contains 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
while read -d $'\0' file; do | |
"${file}" に対して処理 | |
done < <(find ディレクトリ -mindepth 1 -maxdepth 1 -print0) |
This file contains 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
max(end_date) keep (dense_rank last order by end_date nulls last) |
This file contains 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
#!/usr/bin/env bash | |
diff\ | |
<(tee <$1 >(echo 左側:`wc -l`行>&2)) \ | |
<(tee <$2 >(echo 右側:`wc -l`行>&2)) &&\ | |
echo 一致しました>&2 |
This file contains 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
class C: | |
def __init__(self, n): | |
self.n = n | |
def m(self, x, y): | |
print('self.n:%s, x:%s, y:%s' % (self.n, x, y)) | |
i = C(1) | |
C.m # クラスメソッド参照 | |
i.m # インスタンスメソッド参照 |
This file contains 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 iterate_by_slice(s: slice, length: int): | |
i, stop, step = s.indices(length) | |
if step > 0 : | |
while i < stop: | |
yield i | |
i += step | |
else: | |
while i > stop: | |
yield i | |
i += step |
This file contains 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
distance_km = 6371 * acos( | |
cos(latA/180*pi) * cos((lonB - lonA)/180*pi) * cos(latB/180*pi) + | |
sin(latA/180*pi) * sin(latB/180*pi) | |
); |
This file contains 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.HashSet; | |
import java.util.Set; | |
/** | |
* xの多項式を表します | |
*/ | |
public class Polynomial | |
{ | |
/** | |
* @param a 定数, 1次係数, 2次係数, 3次係数, ... と係数を指定します |
This file contains 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
/** | |
* 指定したjarファイルから指定interfaceの実装クラス(引数なしコンストラクタを持つもの)をすべてロードして返します。 | |
* @param jarPath jarファイル | |
* @param i 実装しているべきinterfaceまたは親クラス | |
* @param <Interface> 実装しているべきinterfaceまたは親クラス | |
* @return jarファイル内に含まれる、条件に合うクラスすべてを含むリスト | |
* @throws IOException jarファイルの読み込みができませんでした。 | |
*/ | |
public static <Interface> List<Class<Interface>> loadClassesInJar(String jarPath, Class<Interface> i) throws IOException | |
{ |
This file contains 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
/** Extends array object */ | |
interface Array<T> { | |
/** Returns the first element that satisfies the predicate */ | |
first(predicate:(element:T) => boolean, defaultVaule: T): T; | |
/** Returns the last element that satisfies the predicate */ | |
last(predicate:(element:T) => boolean, defaultVaule: T): T; | |
} | |
Array.prototype.first = function (predicate: (element) => boolean, defaultVaule) { | |
for (var i: number = 0; i < this.length; i++) { |
NewerOlder