Skip to content

Instantly share code, notes, and snippets.

kay slimane

Block or report user

Report or block slimane

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@slimane
slimane / Ext1.2.js
Last active Aug 29, 2015
SICPのexcrise1.2をjavascriptで書いた
View Ext1.2.js
// Exercise1.2
var calc = function(f){
return function(){
var tmp;
for (var i = 0; i < arguments.length; i++){
var num = arguments[i];
if (typeof tmp === 'undefined'){
tmp = num;
}else{
tmp = f(tmp, num);
View Duck.hs
module Duck where
class Duck a where
quack :: a -> String
feathers :: a -> String
data Person = Person deriving(Show)
data DomesticDuck = DomesticDuck deriving(Show)
View Aif.vim
function! Aif(a, ope, b)
let a = a:a
let ope = a:ope
let b = a:b
execute 'return ' . a . ope . b . ' ? ' . a . ' :' . b
endfunction
function! Bigger(a, b)
return Aif(a:a, '>', a:b)
endfunction
View fontresize.vim
command! -nargs=0 -bar FontReSize call s:changeFontSize()
function! s:changeFontSize()
let font_size_pat = '(.{-}\S:h)(\d+\.?\d*)(.{-})'
let valid_num_pat = '\d+(\.(0|5))?'
let current_font_size = substitute(&guifont, '\v^' . font_size_pat . '$', '\2', '')
if current_font_size !~ '\v^' . valid_num_pat . '$'
return
endif
" disalbe ime
View lang.txt
Algol
B
C
D
Erlang
F#
Go
Haskell
io
Java
View 女性客の年齢分布.hs
import Data.List
data Sex = Male | Female deriving (Show, Eq, Ord)
data Customer = Customer{ sex :: Sex, age :: Int } deriving(Show, Eq, Ord)
(|>) :: a -> (a -> b) -> b
x |> f = f x
View test.ex
--haskell
foldl (+) 0 $ filter (<5) [1,2,3,4,5,6]
--elixiri
[1,2,3,4,5,6] |> Enum.filter(&(&1 < 5)) |> List.foldl(0, &(&1 + &2))
View fizzBuzz.hs
module FizzBuzz(fizz, buzz, gizz, hizz) where
-- しよういめ~じ
-- fizzz . buzz . gizz . hizz $ (542, "")
hizz (n, s) = fizzBuzz (n, 9) "Hizz" s
gizz (n, s) = fizzBuzz (n, 7) "Gizz" s
buzz (n, s) = fizzBuzz (n, 5) "Buzz" s
fizz (n, s) = fizzBuzz (n, 3) "Fizz" s
View someFunc.hs
/* 2個の引数を受け取るsomeFuncの定義で一番お勧めなのはどれなんでしょう */
funcA a b = a * b + (a + b)
a `someFunc` b = a `funcA` b
someFunc a b = funcA a b
someFunc a b = a `funcA` b
a `someFunc` b = funcA a b
View leave_insert.vim
" インサートモードに入るか、入力を行った最後の時間変数に保存
autocmd! InsertEnter,InsertChange * :let s:last_action_time = localtime()
autocmd! CursorMovedI * :call s:leave_insert_mode() | let s:last_action_time = localtime()
autocmd! InsertCharPre * :call s:leave_insert_mode("call feedkeys('" . v:char . "', 'n')", "let v:char = '' ")
You can’t perform that action at this time.