Skip to content

Instantly share code, notes, and snippets.

use std::iter::{Iterator, iterate};
use std::num::Int;
struct Fib<T, I> where T: Int, I: Iterator<Item=T> {
it : I
}
impl <T, I> Iterator for Fib<T, I> where
T: Int,
I: Iterator<Item=T>,
use std::iter::Iterator;
use std::num::Int;
struct Doubler<'a, T, I> where T: Int, I: Iterator<Item=&'a T> {
it : I
}
impl <'a, T, I> Iterator for Doubler<'a, T, I> where
T: 'a + Int,
I: Iterator<Item=&'a T>,
@takscape
takscape / gist:2c2d175705957ddb86b3
Created December 22, 2014 01:26
国土交通省の街区レベル位置参照情報CSVのダウンロード用URLを一括取得するCasperJSスクリプト
var casper = require('casper').create();
casper.start('http://nlftp.mlit.go.jp/cgi-bin/isj/dls/_choose_method.cgi', function() {
this.echo(this.getCurrentUrl());
this.click('input[type="submit"][value=" 都道府県単位 "]');
});
casper.then(function () {
this.echo(this.getCurrentUrl());
this.click('input[id="allac"]');
@takscape
takscape / gist:163c35c73cc47e222375
Created December 10, 2014 05:23
Memo: bootstrap template
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Todo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
</head>
<body ng-app="App">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
@takscape
takscape / gist:9baebeb496210f6be428
Created November 13, 2014 04:30
How to launch fish in byobu
# .byobu/.tmux.conf
set -g default-shell /usr/bin/fish
set -g default-command /usr/bin/fish
@takscape
takscape / gist:a23391aec1b7e4a31863
Created October 31, 2014 19:59
Fibonacci Sequence in Kotlin (5)
import java.math.BigInteger
import kotlin.math.plus
fun main(args: Array<String>) {
fibo().take(10).forEach { println(it.first) }
}
private fun fibo() =
stream(BigInteger.ZERO to BigInteger.ONE, {(e) ->
e.second to (e.first plus e.second)
@takscape
takscape / gist:8290d649bdd0148c0195
Created October 31, 2014 19:40
Fibonacci Sequence in Kotlin (4)
import java.math.BigInteger
import kotlin.math.plus
fun main(args: Array<String>) {
fibo().take(10).forEach { println(it.cur) }
}
data class FiboEntry(val cur : BigInteger, val next : BigInteger)
private fun fibo() =
stream(FiboEntry(BigInteger.ZERO, BigInteger.ONE), {(e) ->
@takscape
takscape / gist:af3d93aa314cbec6c054
Created October 31, 2014 19:37
Fibonacci Sequence in Kotlin (3)
import java.math.BigInteger
import kotlin.math.plus
fun main(args: Array<String>) {
fibo().take(10).forEach { println(it.cur) }
}
data class FiboEntry(val cur : BigInteger, val next : BigInteger)
private fun fibo() : Stream<FiboEntry> {
return stream(FiboEntry(BigInteger.ZERO, BigInteger.ONE), {(e) ->
@takscape
takscape / gist:8147e068a554d3ad537b
Created October 31, 2014 19:27
Fibonacci Sequence in Kotlin (2)
import java.math.BigInteger
import kotlin.math.plus
fun main(args: Array<String>) {
fibo().take(10).forEach { println(it) }
}
data class FiboEntry(val cur : BigInteger, val next : BigInteger)
private fun fibo() : FunctionStream<BigInteger> {
var tmp = FiboEntry(BigInteger.ZERO, BigInteger.ONE)
@takscape
takscape / gist:957ca588251bf1f64c77
Created October 31, 2014 19:19
Fibonacci Sequence in Kotlin
import java.math.BigInteger
import kotlin.math.plus
fun main(args: Array<String>) {
fibo().take(10).forEach { println(it) }
}
private fun fibo() : FunctionStream<BigInteger> {
var cur = BigInteger.ZERO
var next = BigInteger.ONE