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
<?php | |
if (empty($_REQUEST['since_id'])) { | |
$since_id = 0; | |
} else { | |
$since_id = (int)$_REQUEST['since_id']; | |
} | |
$db = new PDO("pgsql:...", 'user', 'pass', array( | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
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
LeftDiamond := False | |
AltTab := False | |
RightDiamond := False | |
Vim := False | |
VimRepeat := 0 | |
;; 不慮の事態に備えて起動時/リロード時に Windows キーを解放 | |
Send, {LWin up} |
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
const string chars = "0123456789"; | |
var ret = chars.Aggregate(new StringBuilder(), (sb, c) => sb.AppendFormat("{0} ", c)); |
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
Stopwatch sw = new Stopwatch(); | |
string str = new string(' ', 1024 * 1024 * 8); | |
sw.Restart(); | |
{ | |
var ret = str | |
.Select(c => string.Format("[{0}]", c)) | |
; | |
string.Join("", ret); | |
} |
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
private void Form1_Load(object sender, EventArgs e) { | |
var down = Observable.FromEvent<MouseEventArgs>(this, "MouseDown"); | |
var move = Observable.FromEvent<MouseEventArgs>(this, "MouseMove"); | |
var up = Observable.FromEvent<MouseEventArgs>(this, "MouseUp"); | |
var diff = move | |
.SkipUntil(down) | |
.TakeUntil(up) | |
.Let(m => m.Zip(m.Skip(1), (l, r) => new { Left = l, Right = r })) | |
.Repeat() |
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
Observable.FromEvent<KeyEventArgs>(this, "KeyDown") | |
.BufferWithTimeOrCount(TimeSpan.FromMilliseconds(2000), 6) | |
.Select(keys => keys.Select(key => key.EventArgs.KeyCode)) | |
.Where(keys => keys.SequenceEqual(new[] { Keys.K, Keys.O, Keys.N, Keys.M, Keys.A, Keys.I })) | |
.Repeat() | |
.Subscribe(_ => MessageBox.Show("Hit !")) | |
; |
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
new[] { 1, 2, 3, 4, 5 } | |
.Join(new[] { 1, 2, 3, 4, 5 }, _ => 1, _ => 1, (i, j) => new { i, j }) | |
.Join(new[] { 1, 2, 3, 4, 5 }, _ => 1, _ => 1, (ij, k) => new { i = ij.i, j = ij.j, k }) | |
.Where(v => (v.i + v.j + v.k) % 10 == 0) | |
.Run(Console.WriteLine) | |
; | |
/* | |
{ i = 1, j = 4, k = 5 } | |
{ i = 1, j = 5, k = 4 } |
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
/* | |
http://www.shido.info/lisp/scheme_amb.html | |
SICP の問題 4.42. を解いてみましょう。問題は以下の通りです: | |
5人の女子生徒が試験を受けた。彼女らの両親は結果に対し過度の関心を持っている、と彼女らは考えている。 そこで彼女らは自宅へ試験についての手紙を書くのに、誰もが1つの正しい情報と1つのうその情報を書こうと 約束した。以下は彼女らの手紙の関係する部分である。 | |
Betty: 「Kitty は試験が2番で私は3番でした。」 | |
Ethel: 「私がトップと聞いてうれしいでしょう。Joan が2ばんでした。」 | |
Joan: 「私は3番でした。可哀想な Ethel はビリでした。」 |
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
$.fn.extend({ | |
sideEffect: function(func) { | |
func.apply(this); | |
return this; | |
} | |
}); | |
$('<div />') | |
.append('<img src="hoge.png" />') | |
.append($('<span />') |
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
@ test.php (chmod +x test.php) | |
#!/usr/bin/php | |
<?php | |
echo 'test'; | |
@ test2.php | |
<?php | |
system('./test.php'); |
OlderNewer