Skip to content

Instantly share code, notes, and snippets.

@aoi0308
aoi0308 / pipe.js
Created June 28, 2012 03:33
Nodeの裏でJavaのプログラムを起動して標準入出力をパイプするプログラム
var util = require('util')
,spawn = require('child_process').spawn
,java = spawn('java', ['Sample']);
process.stdin.resume();
java.stdin.on('close', function() {
process.exit(0);
});
util.pump(process.stdin, java.stdin);
@aoi0308
aoi0308 / closure2.js
Created September 9, 2012 15:11
クロージャのサンプル その2
var plus5 = addfac(5);
console.log(plus5(10));
function addfac(n) {
return function(m) {
return n + m;
};
}
@aoi0308
aoi0308 / ezlibrarian.patch
Created December 5, 2012 08:00
ezLibrarianの修正パッチと日本語対応
diff -r -u redmine_ezlibrarian.origin//app/views/lib_mailer/lib_new.text.html.rhtml redmine_ezlibrarian/app/views/lib_mailer/lib_new.text.html.rhtml
--- redmine_ezlibrarian.origin//app/views/lib_mailer/lib_new.text.html.rhtml 2009-07-14 14:13:45.000000000 +0900
+++ redmine_ezlibrarian/app/views/lib_mailer/lib_new.text.html.rhtml 2011-08-26 09:20:51.281250000 +0900
@@ -34,7 +34,7 @@
<td style="width:35%"><%= @book.holder_change_histories_count > 1 ? "#{@book.holder_change_histories_count - 1} " : 0 %></td>
</tr>
<tr>
- <td style="width:15%"><b><%=l(:field_author)%>:</b></td>
+ <td style="width:15%"><b><%=l(:field_book_author)%>:</b></td>
<td style="width:35%"><%= @book.author %></td>
@aoi0308
aoi0308 / Sample_LINQ_GetElementById.cs
Last active December 11, 2015 20:09
xml.GetElementById("hoge") 相当のことを LINQ to XML でする。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace ConsoleApplication1
{
class Program
{
@aoi0308
aoi0308 / mtg_recipe_200108_Burn.txt
Last active December 12, 2015 06:09
2001年8月当時 の赤単バーン 7E, MM, NE, PR, IN, PS, AP
【メインボード】
生物 12
Raging Goblin 4 7E
Mogg Sentry 4 PS
Goblin Raider 4 7E
火力 26
Shock 4 7E
Seal of Fire 4 NE
Volcanic Hammer 4 7E
@aoi0308
aoi0308 / Module1.bas
Created March 4, 2013 06:16
Excelの全部のシートの特定セルを置換する
Attribute VB_Name = "Module1"
Sub Clear()
Dim wsCurrent As Worksheet
For Each wsCurrent In ThisWorkbook.Worksheets
wsCurrent.Range("xy").Value = "foo"
Next
End Sub
@aoi0308
aoi0308 / mtg_recipe_20130413_Burn
Last active December 16, 2015 04:59
4月13日のレガシー杯に出たデッキ
-- メインボード 60
-- クリーチャー 9
4x ゴブリンの先達/Goblin Guide
2x 渋面の溶岩使い/Grim Lavamancer
3x ケルドの匪賊/Keldon Marauders
-- スペル 27
3x ギタクシア派の調査/Gitaxian Probe
3x はらわた撃ち/Gut Shot
4x 稲妻/Lightning Bolt
@aoi0308
aoi0308 / fact.js
Last active December 20, 2015 17:58
JavaScriptでYコンビネータ。 fact.jsはそれを使って定義した関数。
function fact(n) {
return Y(fact0)(n);
}
document.write(fact(6));
@aoi0308
aoi0308 / tobi_failed.js
Created September 6, 2013 02:25
Node 0.10.x でtobiが上手く動かないケース。 5回目のリダイレクトをする際に、なぜかリダイレクト後のリクエストを飛ばしてくれない。
/* 2013/09/06
* {
* "dependencies": {
* "tobi": "git://github.com/yssk22/tobi.git"
* },
* "engine": {
* "node": "0.10"
* }
* }
*/
@aoi0308
aoi0308 / string_each.js
Created September 7, 2013 02:46
JavaScriptの文字列をforEachでループ処理する。
// 処理対象の文字列
var str = "Hello, JavaScript!";
// 通常のfor文で行う
for (var i = 0; i < str.length; i++) {
console.log(str[i]);
}
// 一応動くけど、まぁやめた方が良い
for (var i in str) {