注意:ライブラリなどを使用すれば更にかんたんに安定に取得できる可能性がありますが、
ここではライブラリを使わずにAPIKEYだけで使えるAPIのみで取得することを優先しています
この工程は省略できますが、毎回IDを教えて上げる必要があります。
| Complete command list of NotSoBot <170903342199865344>: | |
| Owner: NotSoSuper <130070621034905600> | |
| Prefix: . | |
| * = Not Required | |
| ^ = Bot Owner Only | |
| ^^ = Server Admin Only | |
| "/'s" in commands show aliases for the command (Ex: ".reverse/r <text>" Command can be run with .reverse or .r) | |
| <max_messages> = The number of messages to search through | |
| <image> = The image URL, @discord_user, the users name, discord/custom emoji, or, nothing inputted which will search through 25 messages for embeds or attachments | |
| <image-face> = Image requires a HUMAN FACE to be included |
| const app = require('http').createServer(handler) | |
| const io = require('socket.io')(app) | |
| const path = require('path') | |
| const fs = require('fs') | |
| const mime = require('mime-types') | |
| io.sockets.on('connection', socket => { | |
| socket.on('socket', data => { | |
| console.log(data) | |
| io.sockets.emit('socket',data) |
加筆編集しより多くの人に理解できるようにしたものをQiitaに投稿しました。 こっちはリンク、リビジョン確認用に残しますが、これからの修正はQiitaメインになります。 alert無限ループは不正プログラムとして逮捕されるらしいので警察にゴールドバッハ予想を証明してもらおう - Qiita
これは以下のツイートに触発されて作ったn回目のアラートダイアログで2n+2を二つの素数の和で表せるかを全探索して表せた場合もう一度アラートダイアログを表示するJavaScriptプログラムだよ
n回目のアラートダイアログで2n+2を二つの素数の和で表せるかを全探索して表せた場合もう一度アラートダイアログを表示するみたいなプログラムを書けば警察がゴールドバッハ解いてくれるのでは
— ほんまか? (@Kory__3) March 4, 2019
| // Referred to https://raw.githubusercontent.com/denoland/deno_std/v0.3.2/http/server.ts | |
| function deferred() { | |
| let resolve, reject | |
| const promise = new Promise((res, rej) => { | |
| resolve = res | |
| reject = rej | |
| }) | |
| return { | |
| promise, |
| // Utility function to make fake async processing | |
| const delay = fn => new Promise(r => setTimeout(() => r(fn()), 100)) | |
| const isConstant = n => delay(() => n < 2) | |
| const fibo = async n => { | |
| if (await isConstant(n)) return n === 0 ? 0 : 1 | |
| const [prev1, prev2] = await Promise.all([fibo(n - 1), fibo(n - 2)]) | |
| return delay(() => prev1 + prev2) | |
| } |
| const cp = copy | |
| const observe = (target, callback) => { | |
| const observer = new MutationObserver(records => { | |
| records.forEach(record => { | |
| if (!record.addedNodes[0]) return | |
| callback(record, () => observer.disconnect()) | |
| }) | |
| }) | |
| observer.observe(target, { childList: true }) | |
| } |
| #!/bin/bash -e | |
| if [ $# -ne 1 ]; then | |
| echo "引数(パス)が必要です。" 1>&2 | |
| exit 1 | |
| fi | |
| CMD=$(curl -m 5 -sS "https://ppng.ml/$1") | |
| read -p "$CMD を実行しますか? (y/N): " YN |
| const f1 = <T>(val: T) => val | |
| const f2 = <T>(val: T) => () => val | |
| const t1: 'foo' = f1('foo') | |
| // const f1: <"foo">(val: "foo") => "foo" | |
| const t2: 'foo' = f2('foo')() | |
| // const f2: <string>(val: string) => () => string | |
| // Type 'string' is not assignable to type '"foo"'. ts(2322) |
| var addon = require('../native'); | |
| const factorial = (x) => { | |
| let res = x; | |
| let done = false; | |
| while (!done) { | |
| x = x - 1; | |
| res = res * x; |