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
def eight_queen(n = 8, m = 8) | |
run(n, m, []) | |
end | |
def run(kinds, len, a) | |
return unless can_set_queen?(a) | |
if len == 0 then | |
puts a.join(',') | |
else | |
kinds.times { |i| |
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 timer = function(sec, internal, finished) { | |
var limit = parseInt(sec); | |
var count = 0; | |
var counter = setInterval(function(){ | |
count++; | |
if(count < limit) { | |
if(typeof internal == "function") internal(count, limit); | |
} else { | |
if(typeof finished == "function") finished(count, limit); | |
clearInterval(counter); |
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
def gyapin(image, source, alt, title) | |
host = "http://pinterest.com/pin/create/bookmarklet/" | |
url = host + "?media=" + image + | |
"&url=" + source + | |
"&alt=" + alt + | |
"&title=" + title + "&is_video=false" | |
system "google-chrome \"#{url}\"" | |
end | |
gyapin("http://cache.gyazo.com/99ba9338b392dc5750492cfc1f0c4f94.png", |
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 express = require('express'); | |
var parse_cookie = require('connect').utils.parseCookie; | |
var MemoryStore = express.session.MemoryStore; | |
var session_store = new MemoryStore(); | |
var app = module.exports = express.createServer(); | |
app.configure(function(){ | |
app.use(express.bodyParser()); | |
app.use(express.cookieParser()); | |
app.use(express.methodOverride()); |
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
(function($) { | |
/* extend jQuery */ | |
$.fn.yellow = function(options) { | |
$(this).css('background-color', 'yellow'); | |
return "plugin test"; | |
}; | |
})(jQuery); |
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 Node = function(value, left, right, word){ | |
this.value = value; | |
this.left = left; | |
this.right = right; | |
this.word = word; | |
}; | |
var HuffmanTree = function(wordcount){ | |
this.list = []; | |
for (var word in wordcount) { | |
this.list.push(new Node(wordcount[word], null, null, word)); |
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.collection.mutable.HashMap | |
class HuffmanTree(str: String) { | |
abstract class Node { | |
val count: Int | |
} | |
case class Leaf(str:String, count:Int) extends Node | |
case class Branch(left: Node, right: Node) extends Node { | |
val count = left.count + right.count | |
} |
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
(function($){ | |
$.fn.colorFocus = function(color, trigger){ | |
var defaultColor = $(this).css('background-color'); | |
var hasTrigger = (typeof trigger == 'function'); | |
$(this).mouseover(function(e){ | |
if (hasTrigger && false == trigger(this)) return; | |
$(this).css('background-color', color); | |
}); |
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
hoge |
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
apply plugin: 'android' | |
apply plugin: 'android-apt' | |
android { | |
compileSdkVersion 19 | |
buildToolsVersion "19.0.3" | |
defaultConfig { | |
minSdkVersion 9 | |
targetSdkVersion 14 |