Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@slimane
slimane / gist:6460139
Created September 6, 2013 06:11
common lispでのBMI計算コード。私新しい言語勉強したらとりあえずこれ書くんです。
(defun calc_bmi (height weight)
(float
(flet (
(twice (number)
(* number number))
(divid-100(number)
(/ number 100))
)
(/
weight
@slimane
slimane / FavoriteColor.vim
Last active December 22, 2015 15:09
colorschmeを選択するcommand書いた
command! -nargs=1 -bar -complete=customlist,Favorite_Color FavoriteColor call Set_Favorite_Color(<q-args>)
" colorschemeとそれに関連するGui情報を格納したobject
function! s:color_dict_object(colorscheme, transparency, ...)
let l:color_dict = {}
let l:color_dict.colorscheme = a:colorscheme
let l:color_dict.background = get(a:, '1', '')
let l:color_dict.transparency = a:transparency
return l:color_dict
endfunction
@slimane
slimane / font.vim
Last active December 23, 2015 07:58
scriptencoding=utf-8
function! objects#font#New()
let font = {}
let font.name = ''
let font.encoding = 'DEFAULT'
let font.iconv_to = 'utf-8'
let font.size = 12
let font.options = ''
function! Init_lightline()
call lightline#init()
call lightline#colorscheme()
call lightline#update()
endfunction
augroup Init_lightLine.vim
autocmd!
autocmd BufWritePost * call Init_lightline()
augroup end
@slimane
slimane / full_to_half.vim
Created September 24, 2013 10:15
全角文字は死ね
command! FullToHalf call s:full_to_half.substitute()
let s:full_to_half = {}
let s:full_to_half.table = {
\ ' ' : ' '
\ , '(' : '('
\ , ')' : ')'
\ , ':' : ':'
\ , '0' : '0'
@slimane
slimane / is_loaded.vim
Last active December 27, 2015 01:49
is_loaded
let s:is_loaded_flg = 's:' . substitute(expand('<sfile>:p'), '\W', '_', 'g')
if exists(s:is_loaded_flg)
finish
else
execute 'let ' . s:is_loaded_flg . ' = 1'
endif
command! -range=%
\ OverCommandLine
\ call over#command_line(
\ g:over_command_line_prompt,
\ ( <line1> == 1 && <line2> == line('$')
\ ? '%'
\ : <line1> != <line2>
\ ? printf("%d,%d", <line1>, <line2>)
\ : '.'
\ ) . 's/\v'
@slimane
slimane / 2013_A_shopping_list..rb
Created December 4, 2013 08:43
2013年12月の買った本リスト
class InvalidateCurrencyUnitError < RuntimeError; end;
module CurrencyUnit
USD = 1
EURO = 2
YEN = 3
def validate_currency_unit(currency_unit)
if currency_unit == USD; return true; end;
if currency_unit == EURO; return true; end;
@slimane
slimane / stat.hs
Created December 6, 2013 05:34 — forked from anonymous/stat.hs
{-
summary :
odds比を計算
detail :
与えられた群Aと、(全体-群A)との発生率との比を計算
args :
total --全体の数
incidence --全体の発生数
a_total --群Aの全体数
a_incidence --群Aの発生数
Function REGMATCH(target As String, pattern As String, Optional g As Boolean = False, Optional ignoreCase As Boolean = False, Optional multiLine As Boolean = False) As Boolean
If Len(pattern) = 0 Then
REGMATCH = False
Exit Function
End If
Dim r As New RegExp
With r
.multiLine = multiLine
.Global = g