Skip to content

Instantly share code, notes, and snippets.

View higumachan's full-sized avatar

Yuta Hinokuma higumachan

View GitHub Profile
#ifndef INCLUDE_GUARD_ICT_MALLOC_H
#define INCLUDE_GUARD_ICT_MALLOC_H
#define HEAP_SIZE (1000000)
void *ict_malloc(unsigned int size);
void ict_free(void *p);
char heap[HEAP_SIZE];
IObservable<double> MovingAvg(IObservable<double> targetStream, int windowSize)
{
return targetStream.Zip(
targetStream.Skip(windowSize)
.StartWith(Enumerable.Repeat(0.0, windowSize)),
(l, r) => Tuple.Create(r, l))
.Scan(0.0, (ago, next) => { return ago - next.Item1 + next.Item2; })
.Skip(windowSize)
.Select(x => x / windowSize)
;
function drag(callback){
var downFlag;
mouseDown(function(x, y){
downFlag = true;
});
mouseUp(function(x, y){
downFlag = false;
});
#include <iostream>
#include <type_traits>
#include <cmath>
#define VARIABLE Variable<float, __COUNTER__>
template<
typename T,
int ID
>
@higumachan
higumachan / vs1.py
Last active January 17, 2017 10:37
vs
from __future__ import print_function
import timeit
if __name__ == '__main__':
fnpy_time = timeit.timeit("map(_ + 1, xrange(1000))", setup="from fn import _", number=100)
pyscalambda_time = timeit.timeit("map(_ + 1, xrange(1000))", setup="from pyscalambda import _", number=100)
print("pyscalambda_time",pyscalambda_time)
print("fbpy_time", fnpy_time)
@higumachan
higumachan / vs2.py
Last active January 21, 2017 01:25
from pyscalambda import _ as _1
from fn import _ as _2
from itertools import imap
import timeit
if __name__ == '__main__':
fnpy_time = timeit.timeit("map(_ + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1, xrange(1000))", setup="from fn import _", number=100)
pyscalambda_time = timeit.timeit("map(_ + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1, xrange(1000))", setup="from pyscalambda import _", number=100)
from itertools import imap
import timeit
if __name__ == '__main__':
cached_time = timeit.timeit("map(_ + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1, xrange(1000))", setup="from pyscalambda import _", number=100)
nocached_time = timeit.timeit("map((_ + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1+ 1 + 1 + 1 + 1 + 1).nocache(), xrange(1000))", setup="from pyscalambda import _", number=100)
print(cached_time, nocached_time)
ja:
admin:
actions:
import:
title: "%{model_label} をインポート"
menu: "インポート"
breadcrumb: "インポート"
link: "インポート"
bulk_link: "インポート"
done: "一括作成"
@higumachan
higumachan / rails_admin_import.ja-MX.yml
Created August 26, 2017 03:37
A japanese translation for stephskardal/rails_admin_import (https://github.com/stephskardal/rails_admin_import) Raw
ja:
admin:
actions:
import:
title: "%{model_label} をインポート"
menu: "インポート"
breadcrumb: "インポート"
link: "インポート"
bulk_link: "インポート"
done: "一括作成"
syntax on
set autoindent
"バックアップファイルを作るディレクトリ
set backupdir=$HOME/.vimbackup
"ファイル保存ダイアログの初期ディレクトリをバッファファイル位置に設定
set browsedir=buffer
"クリップボードをWindowsと連携
"set clipboard=unnamed