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
class Prize { | |
var winners: List[Int] = List.empty | |
def play(list: List[Int]) : List[List[Int]] = { | |
var w = List[Int]() | |
var l = List[Int]() | |
for (idx <- 0 until list.length/2) { | |
val i = idx*2 | |
if (list(i) < list(i+1)) { | |
w :+= list(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
$ brew cask install basictex | |
$ sudo tlmgr update --self | |
$ sudo tlmgr install latexmk |
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
# http://www.codewars.com/kata/unary-function-chainer | |
# http://stackoverflow.com/questions/28713934/how-to-implement-unary-function-chainer-using-python | |
f1 = (x) -> x*2 | |
f2 = (x) -> x+2 | |
f3 = (x) -> x^2 | |
chained(funcs) = reduce((f,g)->(n)->n|>f|>g, funcs) | |
@assert 4 == chained([f1 f2 f3])(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://mrkulk.github.io/www_cvpr15/1999.pdf | |
function PROGRAM(MU, PC, EV, VERTEX_ORDER) | |
# Scene Language: Stochastic Scene Gen | |
face=Dict(); | |
shape = []; | |
texture = []; | |
for S in ["shape", "texture"] | |
for p in ["nose", "eyes", "outline", "lips"] | |
coeff = MvNormal(0,1,1,99) |
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
# load Dates module | |
import Base.Dates: AbstractTime, Month, Millisecond, Year, TimeType, Day, Hour, Minute, Second, Period, periodisless, yearmonthday, days, hour, minute, second, millisecond, default | |
import Base.Dates: DelimitedSlot, Slot, DayOfWeekSlot, slotparse | |
import Base.Dates: DateFormat, duplicates | |
Base.show(io::IO,x::DateTime) = print(io,string(x)) | |
DateTime(dt::AbstractString,df::DateFormat=ISODateTimeFormat) = DateTime(parse(dt,df)...) | |
function getslot(x,slot::DelimitedSlot,df,cursor) |
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
for filename in readdir(".") | |
if contains(filename, ".mpg") | |
mp3 = replace(filename, ".mpg", ".mp3") | |
if !isfile(mp3) | |
println("ffmpeg -i $filename -vn -ar 44100 -ac 2 -ab 192 -f mp3 $mp3") | |
end | |
end | |
end |
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 KangXi | |
using FileTools | |
using Base.Test | |
db = mapper(f"2500.json", (:id, :hanja, :pinyin)) | |
@test [5] == find(:id=>5, db) | |
@test [1,2,3,4,5] == find(d->d[:id]<=5, db) | |
# λ ~/.julia/v0.5/KangXi/test master julia runtests.jl | |
# Test Summary: | Pass Total |
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
// | |
// TestSys.swift | |
// Test | |
// | |
// Created by wookyoung on 1/29/16. | |
// Copyright © 2016 factorcat. All rights reserved. | |
// | |
import Foundation |
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 Foundation | |
class TestDates: WTestCase { | |
func test_dates() { | |
Assert.equal("ko", NSLocale.currentLocale().languageCode) | |
let d = NSDate(year: 2016, month: 2, day: 5, hour: 13, min: 2, sec: 3) | |
Assert.equal("", d.string(.NoStyle)) | |
Assert.equal("2016. 2. 5. 오후 1:02", d.string(.ShortStyle)) |
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 Foundation | |
class TestTranslate: WTestCase { | |
func test_locales() { | |
let en = NSLocale(localeIdentifier: "en_US") | |
Assert.equal("just now", en.translate("just now")) | |
let ko = NSLocale(localeIdentifier: "ko_KR") | |
Assert.equal("방금", ko.translate("just now")) |