This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Test.Hspec | |
import Test.Hspec.QuickCheck | |
import Test.QuickCheck | |
-- 従来、Hspecで個別のテストケースに対して Gen を定義したい場合、 | |
-- いちいち違う名前を付けるのが面倒なので let ... in で g (あるいはgen)という名前を使い回していたが、 | |
-- 別にそれもdoの中のletで解決できることが発覚した。 | |
main = hspec $ do | |
-- let ... inを使った場合 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main = do | |
-- let ... in を使った場合 | |
let f :: String -> IO () | |
f = putStrLn | |
in f "f" | |
-- ただの let を使った場合(こっちの方が大抵おすすめ!) | |
let g :: String -> IO () | |
g = putStrLn | |
g "g" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
{- stack --resolver lts-17.4 script | |
--package=typed-process | |
--package=filepath | |
--package=modern-uri | |
--package=text | |
-} | |
{-# LANGUAGE OverloadedStrings #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! GoToPreviousWindowWhenQf() abort | |
if &filetype == 'qf' | |
wincmd p | |
endif | |
endfunction | |
let g:quickrun_config = { | |
\ "_": { | |
\ "outputter/quickfix/open_cmd" : "cwindow | call GoToPreviousWindowWhenQf()" | |
\ }, | |
\ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt("Copy", [...document.getElementsByClassName('listItemTitle')].map(e => e.innerText).join("\n")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const input = document.getElementsByClassName("listItemInput")[0]; | |
const form = document.getElementsByClassName("addForm")[0]; | |
function addItem(name){ | |
input.dispatchEvent(new Event("focus")); | |
input.value = name; | |
input.dispatchEvent(new Event("input")); | |
form.dispatchEvent(new Event("submit")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! Denite_do_open(split_cmd, context) abort | |
execute(a:split_cmd) | |
call denite#do_action(a:context, 'open', a:context['targets']) | |
endfunction | |
call denite#custom#action('openable,file,buffer,directory', 'left', funcref('Denite_do_open', ['leftabove vsplit'])) | |
call denite#custom#action('openable,file,buffer,directory', 'below', funcref('Denite_do_open', ['rightbelow split'])) | |
call denite#custom#action('openable,file,buffer,directory', 'above', funcref('Denite_do_open', ['leftabove split'])) | |
call denite#custom#action('openable,file,buffer,directory', 'right', funcref('Denite_do_open', ['rightbelow vsplit'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global _start | |
_start: | |
MOV X0, #65 | |
MOV X8, #93 | |
SVC 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env stack | |
{- | |
stack script --resolver=lts-14.6 | |
--package=mtl | |
--package=containers | |
-} | |
{-# OPTIONS -fdefer-type-errors #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE RankNTypes #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
fact :: Int -> Integer | |
fact 0 = 1 | |
fact n = fromIntegral n * fact (n-1) | |
*/ | |
const fact = function(n){ | |
if (n == 0){ | |
return 1; | |
} else { | |
return n * fact(n - 1); |