View translate-mdn-ja-nvim.vim
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! ToJaPath(enPath) abort | |
" e.g. content\files\en-us\glossary\boolean\html\index.md | |
return substitute(a:enPath, '^content\\files\\en-us', 'translated-content\\files\\ja', '') | |
endfunction | |
function! PrepareJaPath() abort | |
let path_to_index_md = ToJaPath(expand('%')) | |
call mkdir(v:lua.vim.fs.dirname(path_to_index_md), "p") | |
return path_to_index_md | |
endfunction |
View no-empty.hs
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
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE TypeOperators #-} | |
import Data.Kind (Type) | |
data ExampleData (as :: [Type]) = ExampleData |
View bookmarklet.js
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
javascript:location.href="https://www.youtube.com/watch?v="+location.href.slice(`${location.origin}/shorts/`.length) |
View rewrite-the-only-case-where-I-use-let-in.hs
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を使った場合 |
View lets-in-do.hs
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" |
View download-from-m3u8.hs
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 #-} |
View list-google-shopping-list-items.js
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")) |
View add-item-to-google-shopping-list.js
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")); | |
} |
View simulate-left-below-above-right.vim
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'])) |
View asmtut1-1.s
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 |
NewerOlder