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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Xml.Linq; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ |
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
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> |
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
var plus5 = addfac(5); | |
console.log(plus5(10)); | |
function addfac(n) { | |
return function(m) { | |
return n + m; | |
}; | |
} |
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
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); |
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 | |
# | |
# ./node-debug.sh app.js | |
# | |
function usage() { | |
echo "Usage $0 [-p port] [jsfile]" | |
exit 1 | |
} |
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
/* | |
* 実行にはjQueryが必要。 | |
* if文の中で関数外(forEachメソッドの引数は関数です)の変数 n を参照している。 | |
*/ | |
function doClick() { | |
var arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; | |
var n = $('#num').val(); | |
arr.forEach(function(i) { | |
if (i % n == 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
/** | |
* https://gist.github.com/2344525 の別バージョン | |
* 高階関数じゃなくてクラスを使用してみる。 | |
*/ | |
class Accum(private var n: Int) { | |
def apply(i: Int): Int = { n += i; n } | |
} | |
object Accum { | |
def apply(n: Int): Accum = new Accum(n) |
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
/** | |
* ハッカーと画家のP.198に載ってるアキュムレータをScalaで実装。 | |
* 元ネタは Common Lisp | |
* (defun foo (n) | |
* (lambda (i) (incf n i))) | |
* | |
* Int固定じゃなくてもっと汎用的にするにはどうするんだろ。 | |
*/ | |
def accum(n: Int): (Int => Int) = { | |
var m = n |
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 scala.io.Source | |
def widthOfLength(s: String): Int = s.length.toString.length | |
if (args.length == 0) { | |
Console.err.println("Please enter filename") | |
sys.exit(-1) | |
} | |
val lines = Source.fromFile(args(0)).getLines().toList |
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
/** | |
* do execute. | |
* $ scala payment.scala {pocket} {price} | |
*/ | |
object Main { | |
implicit val coins = List(1, 5, 10, 50, 100, 500, 1000, 5000, 10000) | |
def main(args: Array[String]): Unit = { | |
if (args.length != 2) sys.exit(-1) |