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 { WASI, OpenFile, wasi } from "@bjorn3/browser_wasi_shim"; | |
// Workaround for https://github.com/bjorn3/browser_wasi_shim/issues/14 | |
export function patchWasi(self: WASI): void { | |
self.wasiImport.poll_oneoff = (( | |
inPtr: number, | |
outPtr: number, | |
nsubscriptions: number, | |
sizeOutPtr: number, | |
): number => { |
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:(()=>{"use strict";let leftAvailable=255;function fnv1a(t){let l=2166136261;for(let e=0;e<Math.ceil(t.length/2);++e){var n=t.charCodeAt(2*e),d=t.charCodeAt(2*e+1),d=isNaN(d)?0:d;l=(l^(n^d<<16))*16777619}return l}leftAvailable-=".html".length;const re=/[\uD83C-\uDFFF\u2600-\u26FF\\\/:*?"<>|]+/g,titleFsSafe=document.title.replace(re,"").trim(),{href,hostname,pathname,search,hash}=location,urlFsSafe=(""+hostname+pathname+search+hash).replace(re,"_"),fnvHash=fnv1a(""+document.title+href).toString(32);leftAvailable-=fnvHash.length;let safeTitle=titleFsSafe,safeUrl=urlFsSafe;const titleUtf8=(new TextEncoder).encode(titleFsSafe.normalize("NFD")),sumLength=titleUtf8.length+urlFsSafe.length;if(leftAvailable<sumLength){const i=Math.ceil(titleUtf8.length/sumLength*leftAvailable);safeTitle=(new TextDecoder).decode(titleUtf8.slice(0,i)),safeUrl=urlFsSafe.slice(0,leftAvailable-i-1)}document.head.dataset.title4pdforiginaltitle&&document.head.dataset.title4pdforiginalurl===href||(document.head.dataset.title4pdfori |
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
> unison C:\unison-test ssh://user@localhost/unison-test -retry 0 -repeat watch -sshcmd C:\\double\\backslashes\\path\\to\\wsl-as-ssh.cmd |
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 |
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:(()=>{"use strict";const isHttps="https:"===location.protocol,protocolLength=(isHttps?"https://":"http://").length;window.open("https://b.hatena.ne.jp/entry/"+(isHttps?"s/":"")+location.href.slice(protocolLength))})(); |
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
export interface Borrowed<X> { | |
unsafeBorrow<Result>(use: (x: X) => Result): [Borrowed<X>, Result]; | |
get isBorrowed(): boolean; | |
} | |
export class AlreadyBorrowedError extends Error { | |
override name = "AlreadyBorrowedError"; | |
} | |
export function unsafeBorrowed<X>(x: X): Borrowed<X> { |
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 |
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) |
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 |
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' |
NewerOlder