Instantly share code, notes, and snippets.
🍋
Need a lemon?
This file contains hidden or 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{format}from"https://deno.land/std@0.166.0/datetime/mod.ts"; | |
| import{basename,dirname}from"https://deno.land/std@0.166.0/path/mod.ts"; | |
| constargs=Deno.args; | |
| if(args.length===0){ | |
| console.log("No arguments provided"); | |
| Deno.exit(1); | |
| } |
This file contains hidden or 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{encode}from"https://deno.land/std@0.163.0/encoding/base32.ts"; | |
| import{blake2b}from"https://esm.sh/blakejs@1.2.1"; | |
| import{DateTime}from"https://esm.sh/luxon@3.1.0"; | |
| import{assertEquals}from"https://deno.land/std@0.163.0/testing/asserts.ts"; | |
| functionbase32(payload:Uint8Array){ | |
| returnencode(payload).replace(/=/g,"").toLowerCase(); | |
| } | |
| functionblake2b256(payload:string){ | |
| returnblake2b(payload,undefined,32); |
This file contains hidden or 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
| packagehashrock.study.swing; | |
| importorg.assertj.swing.core.GenericTypeMatcher; | |
| importorg.assertj.swing.edt.GuiActionRunner; | |
| importorg.assertj.swing.fixture.FrameFixture; | |
| importorg.assertj.swing.junit.testcase.AssertJSwingJUnitTestCase; | |
| importorg.assertj.swing.timing.Condition; | |
| importorg.junit.Test; | |
| importstaticorg.assertj.swing.timing.Pause.pause; | |
| importstaticorg.assertj.swing.timing.Timeout.timeout; |
hashrock /save-svg-as-png.js
CreatedApril 1, 2020 07:31
This file contains hidden or 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
| //from https://qiita.com/skryoooo/items/a37455bef54321a6195a | |
| //変更内容:関数化とconst化 | |
| functionsaveSvgAsPng(el){ | |
| constsvgData=newXMLSerializer().serializeToString(el); | |
| constcanvas=document.createElement("canvas"); | |
| canvas.width=el.width.baseVal.value; | |
| canvas.height=el.height.baseVal.value; | |
| constctx=canvas.getContext("2d"); |
This file contains hidden or 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{serve}from"https://deno.land/std@v0.19.0/http/server.ts"; | |
| importReactfrom"https://dev.jspm.io/react"; | |
| importReactDOMServerfrom"https://dev.jspm.io/react-dom/server"; | |
| consts=serve(":8000"); | |
| consthello:string="Hello" | |
| constView=(props)=> | |
| <divclassName="deno">{hello},{props.msg}</div>; | |
| window.onload=async()=>{ |
hashrock /vue-ssr.js
CreatedJune 27, 2019 07:44
This file contains hidden or 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
| constVue=require("vue"); | |
| constcreateRenderer=require("vue-server-renderer").createRenderer; | |
| constcompiler=require("vue-template-compiler"); | |
| constrenderToString=createRenderer().renderToString; | |
| varApp={ | |
| template:`<div> | |
| <div v-for="item in items">{{item}}</div> | |
| </div>`, | |
| data(){ |
This file contains hidden or 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
| fromm5stackimport* | |
| importutime | |
| importmath | |
| cnt=0 | |
| m_cnt=cnt | |
| start=False | |
| done=False | |
| definit(): |
hashrock /study-deno-chrome.ts
CreatedMay 11, 2019 12:20
This file contains hidden or 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 * as ws from "https://deno.land/std/ws/mod.ts"; | |
| //TODO 有効なChromeのパスを探す | |
| constchrome= | |
| "/opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app/Contents/MacOS/Google Chrome"; | |
| asyncfunctionmain(){ | |
| constdirName=awaitDeno.makeTempDir({prefix:"deno_chrome_temp"}); | |
| constwidth=400; | |
| constheight=400; |
This file contains hidden or 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
| importReactfrom"react"; | |
| importReactDOMfrom"react-dom"; | |
| constCircle=()=>{ | |
| const[position,setPosition]=React.useState({ | |
| x:100, | |
| y:100, | |
| active:false, | |
| offset:{} | |
| }); |
This file contains hidden or 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
| constfunctions=require("firebase-functions"); | |
| constapp=require("express")(); | |
| constsvgContent="image/svg+xml; charset=utf-8"; | |
| functionresetHMS(d){ | |
| d.setHours(0); | |
| d.setMinutes(0); | |
| d.setSeconds(0); | |
| d.setMilliseconds(0); |
NewerOlder