Skip to content

Instantly share code, notes, and snippets.

View esnya's full-sized avatar

esnya

  • Japan
View GitHub Profile
@esnya
esnya / lex.d
Created January 13, 2015 08:13
import std.algorithm;
import std.exception;
import std.stdio;
import std.range;
import std.traits;
import std.typecons;
class InvalidCharacerException : Exception {
this(string msg, string file = __FILE__, uint line = __LINE__) {
super(msg, file, line);
import std.typetuple;
version (unittest) {
enum Attr1;
enum Attr2;
struct Foo {
@Attr1 int x;
@Attr1 int y;
@Attr1 @Attr2 int z;
@esnya
esnya / psd.d
Created January 26, 2015 09:38
import std.bitmanip;
import std.conv;
import std.exception;
import std.range;
import std.stdio;
import std.traits;
struct PSDHeader {
char[4] signature;
ushort version_;
@esnya
esnya / cal.d
Created February 2, 2015 20:04
auto daysPerYaer(int year) {
if (year % 4 == 0 && !(year % 100 == 0 && year % 400 != 0)) {
return 366;
} else {
return 365;
}
}
unittest {
import std.algorithm;
import std.range;
import std.stdio;
import std.conv;
class CommutativeRing {
uint line;
CommutativeRing left, right;
CommutativeRing inverseOf;
string op;
this(uint line = __LINE__) {
@esnya
esnya / curry.d
Created March 20, 2015 14:42
カリー化してみる
import std.traits;
import std.typecons;
private struct Curry(alias Func, size_t Index = 0) {
private alias _Types = ParameterTypeTuple!Func;
private Tuple!(_Types[0 .. Index]) _args;
static if (Index + 1 == _Types.length) {
ReturnType!Func opCall(_Types[Index] arg) {
return Func(_args.expand, arg);
bindkey -v
setopt auto_cd
setopt auto_pushd
cpdpath=(~)
chpwd_functions=($chpwd_functions dir)
HISTFILE=~/.zsh_history
HISTSIZE=6000000
SAVEHIST=6000000
"NeoBundle Scripts-----------------------------
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=/Users/u_yamada/.vim/bundle/neobundle.vim/
endif
" Required:
@esnya
esnya / ird.d
Created April 21, 2015 03:16
D言語インタプリタもどき(入力ごとにコード生成→コンパイル→実行する力技)
/// InteRactive D console
module ird;
import std.algorithm;
import std.conv;
import std.file;
import std.process;
import std.range;
import std.stdio;
import std.string;
@esnya
esnya / gulpfile.js
Last active August 29, 2015 14:19
markdown ノート用 gulpfile.js
'use strict';
var gulp = require('gulp');
var pandoc = require('gulp-pandoc');
var webserver = require('gulp-webserver');
gulp.task('html', function () {
gulp.src('src/*.md')
.pipe(pandoc({
from: 'markdown',