Skip to content

Instantly share code, notes, and snippets.

@akaneko3
akaneko3 / em-decimal.css
Created November 18, 2014 00:49
全角数字カウンタスタイル
@counter-style em-decimal {
system : numeric;
symbols : "\FF10" "\FF11" "\FF12" "\FF13" "\FF14" "\FF15" "\FF16" "\FF17" "\FF18" "\FF19";
}
@akaneko3
akaneko3 / initial_data.json
Created February 21, 2017 23:03
2012年4月1日現在の政令指定都市のデータ
[
{
"model": "major_city.district",
"pk": 1,
"fields": {
"name": "北海道"
}
},
{
"model": "major_city.district",
package jp.mydns.akanekodou.scala
import math.Rational
object Main extends App {
// ここから
implicit val RationalIsFractional = new Fractional[Rational] {
// compare の実装
def compare(x : Rational, y : Rational) : Int =
(x.numerator * y.denominator) compare (x.denominator * y.numerator)
@akaneko3
akaneko3 / Fact.scala
Last active December 29, 2015 05:39
Factorial with Scala
object Fact {
implicit class RichInt(val n : Int) {
def ! : Int = (1 to n).product
}
}
@akaneko3
akaneko3 / TakePrintLn.hs
Last active December 29, 2015 04:19
リストの最初の n 個を 1 行ごとに表示する
module TakePrintLn (
takePrintLn
) where
takePrintLn :: Int -> [String] -> IO ()
takePrintLn n = putStrLn . unlines . take n
@akaneko3
akaneko3 / factorial.rb
Created October 7, 2013 22:07
Factorial with Ruby
class Integer
def !
(1..self).inject(1, :+)
end
end
puts 3.! # => 6
puts 0.! # => 1
@akaneko3
akaneko3 / JapaneseCalendar.java
Last active December 12, 2015 05:39
西暦から和暦と十二支十干を得る
public class JapaneseCalendar {
private String era;
private String eto;
private final String [] ETO_A = {"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"};
private final String [] ETO_B = {"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"};
public JapaneseCalendar(int year) {
setEra(year);
setEto(year);
}
@akaneko3
akaneko3 / file0.txt
Last active October 27, 2015 14:00
Ruby 2.2.2 の上で Rails 4.2.1 を動かす(RubyInstaller for Windows 編) ref: http://qiita.com/akaneko3/items/247af28abded3b3d3617
> gem install sqlite3 --platform=ruby -- --with-sqlite3-include=C:/temp/sqlite3 --with-sqlite3-lib=C:/temp/sqlite3
> gem install sqlite3
@akaneko3
akaneko3 / fib100000.txt
Created August 12, 2015 12:51
Fibonacci数高速計算
2597406934722172416615503402127591541488048538651769658472477070395253454351127368626555677283671674475463758722307443211163839947387509103096569738218830449305228763853133492135302679278956701051276578271635608073050532200243233114383986516137827238124777453778337299916214634050054669860390862750996639366409211890125271960172105060300350586894028558103675117658251368377438684936413457338834365158775425371912410500332195991330062204363035213756525421823998690848556374080179251761629391754963458558616300762819916081109836526352995440694284206571046044903805647136346033000520852277707554446794723709030979019014860432846819857961015951001850608264919234587313399150133919932363102301864172536477136266475080133982431231703431452964181790051187957316766834979901682011849907756686456845066287392485603914047605199550066288826345877189410680370091879365001733011710028310473947456256091444932821374855573864080579813028266640270354294412104919995803131876805899186513425175959911520563155337703996941035518275274919959802
@akaneko3
akaneko3 / PrimeNumber.java
Last active August 29, 2015 14:18
Stream API を用いた並列化された素数検出プログラム
import java.util.stream.IntStream;
/**
* <p>素数の検出と処理時間の測定</p>
* @author yucchi
* @author redcat
*/
public class PrimeNumber {
/**
* <p>探索の上限</p>