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 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 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 gist:1028628
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 ruby | |
# -*- coding: utf-8 -*- | |
$VERBOSE = true | |
=begin | |
Maybe usable as generator expression in Python | |
requires ruby1.9 or facets ( >= 2.9.1 ) | |
=end | |
if RUBY_VERSION < '1.9' | |
require 'rubygems' |
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 parser-strscan.rb
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
require 'strscan' | |
class Parser | |
def initialize string | |
@scanner = StringScanner.new string | |
end | |
def self.eval string | |
self.new(string).expr |
View .vimrc
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()" | |
\ }, | |
\ } |
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")) |
NewerOlder