これはC87で頒布した部誌「OhUCC!」に寄稿した記事に若干の追記をしたものです.
Markdownとはいわゆるマークアップ言語です. Markdownの簡単な規則に則るだけで整ったHTMLが作成できます. また, 現在ではHTMLだけではなく, LaTeXやPDFなどにも変換するアプリが提供されているため大変汎用的です. ちなみにこの文章もすべてMarkdownで書いています.
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication4 | |
{ | |
class Fraction | |
{ |
class Loan[T <: {def close()}] private(resources: T) { | |
def map[U](func: T => U): Option[U] = | |
try { | |
Option(func(resources)) | |
} catch { | |
case ex: Throwable => | |
ex.printStackTrace() | |
None | |
} finally { | |
if (resources != null) |
def timeOf(action: => Unit, noTimes: Int = 10, multiplier: Int = 1): Double = { | |
import java.util.concurrent.TimeUnit | |
val runtime = Runtime.getRuntime | |
val result = (1 to noTimes + 1) map { _ => | |
val startTime = System.nanoTime | |
var i = 0 | |
while (i < multiplier) { | |
action | |
i += 1 | |
} |
def append2Immutable(noTimes: Long): Unit = { | |
@scala.annotation.tailrec | |
def go(l: List[Int], i: Long = 0): List[Int] = { | |
if (i > noTimes) l | |
else go(l :+ 0, i + 1) | |
} | |
go(List()) | |
} | |
def append2Mutable(noTimes: Long): Unit = { |
#!/bin/bash | |
log=/home/chinachu/chinachu/log/encode | |
echo -----start encoding @$(date +%Y/%m/%d/%H:%M:%S)----- >> $log | |
start=$(date +%s) | |
echo $1 >> $log | |
ffmpeg -i $1 -vcodec libx264 -acodec libfdk_aac -tune animation ${1%.*}.mp4 2>&1 | grep "^[^f]" >> $log |
git filter-branch -f --commit-filter ' | |
if [ "$GIT_AUTHOR_EMAIL" = "{old email}" ]; | |
then | |
GIT_AUTHOR_NAME="{new name}" | |
GIT_AUTHOR_EMAIL="{new email}" | |
GIT_COMMITTER_NAME="{new name}" | |
GIT_COMMITTER_EMAIL="{new email}" | |
git commit-tree "$@" | |
else | |
git commit-tree "$@" |
//直和を表現しきれない点を気にしたら負け | |
public interface IOption<out T> : IEnumerable<T> | |
{ | |
bool HasValue { get; }//== this.Any() | |
} | |
sealed public class Some<T> : IOption<T> | |
{ | |
private readonly T val; | |
public bool HasValue { get { return true; } } |
package com.chatwork.quiz.collection | |
import com.chatwork.quiz.{MySome, MyNone, MyOption} | |
import scala.annotation.tailrec | |
sealed trait MyList[+A] { | |
// Easy |