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://jukensansu.cocolog-nifty.com/planet/2015/11/post-0b4b.html | |
# 総当りで | |
# Rubyはあまり得意でない | |
def array_to_digit(ary) | |
return ary[0] * 100 + ary[1] * 10 + ary[2] | |
end | |
def calc_sum(ary) | |
return array_to_digit(ary[0, 3]) + array_to_digit(ary[2, 3]) + array_to_digit(ary[4, 3]) + array_to_digit(ary[6, 2] + ary[0, 1]) |
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
/** | |
* Based on the following discussion: | |
* http://stackoverflow.com/questions/2345784/jquery-get-height-of-hidden-element-in-jquery | |
* @param jQuery $elem jQuery object | |
*/ | |
function getHeightOfHiddenElem($elem) { | |
$clone = $elem.clone(); | |
$clone.css({'position':'absolute','visibility':'hidden','display':'block'}); | |
$('body').append($clone) | |
var height = $clone.height(); |
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
// 1. Class for MySQL point type | |
class MySQLPoint(val lat: Double, val lng: Double) { | |
import MySQLPoint._ | |
override def toString = { | |
lat.toString() + "," + lng.toString() | |
} | |
/** | |
* Gets a binary representation |
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://stackoverflow.com/questions/4604237/how-to-write-to-a-file-in-scala | |
FileUtils.printToFile(tempFile)(writer => { | |
val it = Source.fromFile(conf).getLines() | |
for (line <- it) { | |
startPattern.findFirstIn(line) match { | |
case Some(_) => | |
while (it.hasNext && it.next.length != 0) {} | |
case _ => | |
writer.println(line) | |
} |
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
(1 to 100)foreach{x=>println(if(x%15>0)if(x%5>0)if(x%3>0)x else"Fizz"else"Buzz"else"FizzBuzz")} |
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
// This file is distributed under the same license as that of Lift. | |
package com.example | |
package lib | |
import net.liftweb.mapper._ | |
import net.liftweb.common._ | |
import net.liftweb.http.S | |
trait MegaCRUDify[KeyType, CrudType <: KeyedMapper[KeyType, CrudType]] |
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
// This file is distributed under the same license as that of Lift. | |
// | |
package com.example { | |
package lib { | |
import net.liftweb._ | |
import common._; | |
import http._; | |
import mapper._ | |
import sitemap._; |
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
# -*- coding: utf-8 -*- | |
# This is my first python script. Whoo hoo! | |
# I needed to create a csv, each line of which consists of | |
# key, Japanese text, and English text, out of Java language | |
# resource files. | |
import sys | |
import glob | |
import re | |
import csv |
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://akka.io/docs/akka/1.1.2/scala/futures.html | |
// にあるサンプルコードの説明をコメントとして記入しました。 | |
// 間違い等があれば指摘してもらえればと思います。 | |
// 以下の2行はnon-blockingな処理 | |
val f1 = actor1 !!! msg1 // actor1 に msg1 を投げ、Futureを得る | |
val f2 = actor2 !!! msg2 // actor2 に msg2 を投げ、Futureを得る | |
// この時点では actor1, actor2 の処理は終わっていない |
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
<html> | |
<script src="jquery-1.6.1.js"></script> | |
<script type="text/javascript"> | |
function test() { | |
//FF4で確認。他のブラウザも要チェック | |
console.log($("#div1")); | |
console.log($("#div1").prop("val")); //NG | |
console.log($("#div1").attr("val")); //OK | |
console.log($("#div1")[0].getAttribute("val")); //OK |