Instantly share code, notes, and snippets.

View ip-copy.user.js
// ==UserScript==
// @name IPアドレスコピー
// @namespace http://tampermonkey.net/
// @version 0.1
// @description CloudGarageのIPアドレスをコピーするユーザスクリプトです
// @author Atsushi
// @match https://console.cloudgarage.jp/*
// @grant none
// ==/UserScript==
View index.go
package main
import (
"fmt"
"syscall/js"
"net/http"
"strconv"
"io/ioutil"
)
View index.go
package main
import (
"fmt"
"syscall/js"
"strconv"
)
func main() {
num1 := js.Global().Get("document").
View index.go
js.Global().Get("document").
Call("querySelector", "#res").
Set("value", "Hello")
View index.go
js.Global().Get("document").
Call("querySelector", "#num1").
Get("value").
String()
View index.
curl -sO https://raw.githubusercontent.com/golang/go/master/misc/wasm/wasm_exec.html
curl -sO https://raw.githubusercontent.com/golang/go/master/misc/wasm/wasm_exec.js
View index.
GOOS=js GOARCH=wasm go build -o test.wasm main.go
View index.go
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello World")
}
View index.rs
extern crate futures;
extern crate js_sys;
extern crate wasm_bindgen;
extern crate wasm_bindgen_futures;
extern crate web_sys;
#[macro_use]
extern crate serde_derive;
use futures::{future, Future};
use js_sys::Promise;
View index.rs
extern crate wasm_bindgen;
extern crate web_sys;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn run() -> Result<(), JsValue> {
let window = web_sys::window().expect("no global `window` exists");
let document = window.document().expect("should have a document on window");
let body = document.body().expect("document should have a body");