Instantly share code, notes, and snippets.

View AmazonIgnoreMarketplaceResult.user.js
// ==UserScript==
// @name Amazonの検索結果からマーケットプレイスを除外する
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Amazonの検索結果にemi=AN1VRQENFRJN5を追加してマーケットプレイス出品を除外します。 via https://github.com/burnworks/bookmarklet-amazon-add-emi-param
// @author Atsushi Nakatsugawa <atsushi@moongift.jp>
// @match https://www.amazon.co.jp/s/*
// @grant none
// ==/UserScript==
View index.js
const go = new Go();
(async () => {
const response = await fetch('main.wasm');
const bytes = await response.arrayBuffer();
const result = await WebAssembly.instantiate(bytes, go.importObject);
go.run(result.instance);
})();
View index.js
const go = new Go();
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then((result) => {
go.run(result.instance);
});
View index.go
todos, err := getTodos(domain)
View index.go
func getTodos(domain string) ([]string, error) {
// 構造体の定義
var todos []string
// HTTPリクエスト
res, err := http.Get(domain)
// エラー処理
if err != nil {
return todos, err
}
// HTTPセッションのクローズ
View index.go
import (
"net/http"
"bytes"
)
View index.go
type Todos struct {
Array []string
}
View index.go
package main
import "syscall/js"
func main() {
window := js.Global().Get("window")
localStorage := window.Get("localStorage")
localStorage.Set("Hello", "World")
println("localStorage -> " + localStorage.Get("JavaScript").String())
}
View index.go
func main() {
window := js.Global().Get("window")
navigator := js.Global().Get("navigator")
cb1 := js.NewCallback(func(args []js.Value) {
if navigator.Get("onLine").Bool() {
println("Network is Online");
} else {
println("Network is Offline");
}
View index.go
go func() {
todo := document.Call("getElementById", "todo")
var value = todo.Get("value").String()
input, err := json.Marshal(Input{Todo: value})
res, err := http.Post(domain, "application/json", bytes.NewBuffer(input))
if err != nil {
log.Fatal(err)
} else {
addTodo(document, value)
}