Skip to content

Instantly share code, notes, and snippets.

@repeatedly
repeatedly / d_master.md
Last active December 17, 2024 10:01
D言語基礎文法最速マスター

他の言語をある程度知っている人はこれを読めばD言語の基礎をマスターでき,D言語の氷山の一角くらいは知ることができると思います.対象バージョンはdmd 2.059です.

1. 基礎

ソースファイル

ASCIIかUTFしか受け付けません.それ以外の文字コードで書くとコンパイルエラーになります.

main

D言語のmainはCとは違い以下のようなシグネチャです.

@repeatedly
repeatedly / downloader.d
Last active October 1, 2015 23:18
D言語でいかにしておっぱい画像をダウンロードするか〜2013
// Written in the D programming language.
/**
* High peformance downloader
*
* Implemented according to <a href="http://yusukebe.com/archives/20120229/072808.html">this implementation</a>.
*
* Example:
* -----
* dmd -L-lcurl -run downloader.d
@emonkak
emonkak / inherit.js
Created December 11, 2011 16:11
inherit.js
function Klass(x)
{
this.member = {
x: x,
};
}
Klass.prototype = {
get x() {
return this.member.x;
$ find path_to_sourcedir/ -name '*.php' > cscope.files
$ cscope -b
$ cat ~/.vimrc
...
if has('cscope')
nnoremap <Leader>s :<C-u>scs find s <C-R>=expand("<cword>")<CR><CR>
nnoremap <Leader>g :<C-u>scs find g <C-R>=expand("<cword>")<CR><CR>
nnoremap <Leader>c :<C-u>scs find c <C-R>=expand("<cword>")<CR><CR>
nnoremap <Leader>t :<C-u>scs find t <C-R>=expand("<cword>")<CR><CR>
@yuroyoro
yuroyoro / Main.scala
Created April 18, 2011 06:52
Scalaの無限リスト(Stream)でいろいろと
// 初期値とstepを指定して永遠にカウントするItrator
class Counter[T:Numeric](init:T = 0,step:T = 1) extends Iterator[T] {
var cnt = init
def hasNext = true
def next = {
cnt = implicitly[Numeric[T]].plus(cnt, step)
cnt
}
// 自分をStreamにする
def asStream = Stream.continually( next )