Skip to content

Instantly share code, notes, and snippets.

View VoQn's full-sized avatar
:shipit:
I may be slow to respond.

Kazuhiro Mizushima VoQn

:shipit:
I may be slow to respond.
View GitHub Profile
@VoQn
VoQn / testLeap.hs
Created September 26, 2010 07:29
閏年判定する関数をHUnit使用するテストする開発コア
import Test.HUnit
-- Target Function for Test
leap :: Integral a => a -> Bool
leap year = if d 100 then d 400
else d 4
where divisible = (== 0) . (mod year)
d = divisible
-- Test Method
@VoQn
VoQn / Search-Hidding-Haskell-Library.sh
Created September 28, 2010 04:50
今 hidding してる Haskell ライブラリを一覧するワンライナー
ghc-pkg list | sed 's/,/, /g' | tr ',' '\n' | grep '('
@VoQn
VoQn / gist:646896
Created October 26, 2010 13:33
ポインタを使った挿入ソート(アルゴリズムクイックリファレンス p71)
// -*- mode:c; coding:utf-8; -*-
// INSERTION SORT PROGRAM
//
// <ORDER>
// BEST: O(n)
// AVERAGE: O(n^2)
// WORST: O(n^2)
#include <stdio.h>
#include <stdlib.h>
@VoQn
VoQn / macos_sing_happy_birthday.sh
Created January 17, 2011 05:22
Macのターミナルで実行できるHappyBirthday. usage > $ sh script.sh "VoQn" 26
#!usr/bin/sh
if [ $# -lt 2 ]; then
echo $0 Failed : Please give 2 arguments \”NAME\(string\) AGE\(natural number\)\"
exit
fi
name=$1
age=$2
yes "happy birthday $name" | head -n $age | say -v Good
class Integer #Override
def prime? #boolean: itself is prime or not.
return true if self == 2
return false if self < 2 || self % 2 == 0
limit = Math::sqrt(self).ceil
(3..limit).step(2) { |i|
return false if self % i == 0
}
return true
end #prime?
@VoQn
VoQn / gauche.rb
Created March 8, 2011 10:03
HomeBrew 用 Gauche-0.9.1 用の Formula. /usr/local/Library/Fomula/ に置いて 'brew install gauche' でインストール
require 'formula'
class Gauche < Formula
url 'http://jaist.dl.sourceforge.net/gauche/Gauche/Gauche-0.9.1.tgz'
homepage 'http://practical-scheme.net/gauche/'
md5 ''
def install
system "./configure", "--enable-multibyte=utf-8", "--prefix=#{prefix}"
" vimrc
" Window
set laststatus=2
" Buffer
set number
syntax enable
set expandtab
set tabstop=4
# Install Common Vim environment
ln -fs $PWD/vim/vimrc.vim $HOME/.vimrc
ln -fs $PWD/vim/gvimrc.vim $HOME/.gvimrc
# Create Vimfiles Directory
mkdir $HOME/.vim
# Added Local Environment vimfiles Setting
mkdir $HOME/.vim/runtime
touch $HOME/.vim/runtime/vimrc.vim
@VoQn
VoQn / animateCSSObject.coffee
Created April 22, 2011 04:18
Generate CSS3 Transition Properties
animateCSS = (css, duration = '1s', timing_function = 'linear', delay = 0) ->
obj = {}
if css?
animate = ''
for property, value of css
obj[property] = value
animate += ', ' unless animate is ''
animate += "#{property} #{duration} #{timing_function} #{delay}"
if animate isnt ''
for browser in ['', '-o-', '-moz-', '-webkit-']
@VoQn
VoQn / animateCSSObject.js
Created April 22, 2011 04:39
Generate CSS3 Transition Properties
(function() {
var animateCSS;
animateCSS = function(css, duration, timing_function, delay) {
var animate, browser, obj, property, value, _i, _len, _ref;
if (duration == null) {
duration = '1s';
}
if (timing_function == null) {
timing_function = 'linear';
}