Skip to content

Instantly share code, notes, and snippets.

@awn-git
awn-git / ankagraph.js
Created January 30, 2017 15:35
安価グラフ
let script_sigma = document.createElement('script');
script_sigma.src = 'https://cdnjs.cloudflare.com/ajax/libs/sigma.js/1.2.0/sigma.min.js';
document.body.appendChild(script_sigma);
/*--------------------------------------
安価グラフを作る
--------------------------------------*/
let f = function () {
@awn-git
awn-git / kansuugataProgramming.js
Created January 25, 2017 15:04
関数型プログラミング練習.js
(function() {
const show = (x) => {
console.log(x);
};
//総和
var arr = [1, 3, 5, 7, 9];
show(arr.reduce((x, y) => x + y));
//最大値
@awn-git
awn-git / bookmarkletkaihatukankyou.md
Created January 17, 2017 15:54
ブックマークレットの開発環境を考えてみた

ブックマークレットの開発環境を考えてみた

きっかけ

以下のような手作業の工程が面倒くさい、と思った。

  • JavaScriptのソースを作る ← これは良い
  • ソースをクリップボードにコピーする ←↓ここからがダルい
  • 目的のサイトなどを開く
  • コンソールを開く
  • ソースをペーストする
  • 実行する
@awn-git
awn-git / memo_vscode.md
Created January 11, 2017 14:04
VS Codeの覚書

VS Codeの覚書

Markdownのプレビューコマンド

以下の通りにキーバインドされている。

{ "key": "shift+cmd+v",
  "command": "markdown.showPreview",

pwdでtreeしたの図

@awn-git
awn-git / test.md
Last active January 9, 2017 12:12

test

コード

jQuery

class jQueryAgent {
    constructor() {}

 set(url) {
@awn-git
awn-git / kakikomisuruScript.md
Created January 3, 2017 15:27
おーぷん2ちゃんねるに書き込みするスクリプト

おーぷん2ちゃんねるに書き込みするスクリプト

これはなに?

FormDataでformDataを作って、XMLHttpRequestでpostするだけのスクリプト

コード

//note: POST用formのデータを作る
var fd = new FormData();
fd.set("MESSAGE", generateRandomText());
@awn-git
awn-git / testmo.md
Created January 2, 2017 03:40
MutationObserveを使う
@awn-git
awn-git / searchUnicode.js
Last active December 29, 2016 20:06
文字列をいい感じに調べるスニペット
function searchUnicode(strs){
let charcodes = strs.split("").map((s) => {return s.charCodeAt();});
let charhex = charcodes.map((s) => {return s.toString(16);});
for(let ix = 0, len = charcodes.length; ix < len; ix++){
console.log(`${strs[ix]} = ${charcodes[ix]}(U+${charhex[ix]}): http://www.fileformat.info/info/unicode/char/${charhex[ix]}/index.htm`);
}
return [charcodes, charhex];
}
@awn-git
awn-git / suredecomposer.js
Created December 27, 2016 16:30
おーぷん2ちゃんねるのread.cgiをパースするn度目のソース
(function(exports) {
let abrowzer = exports.abrowzer || {};
abrowzer.suredecomposer = function() {
class DX {
constructor() {
this.init();
}
getDX() {
let d = document;
@awn-git
awn-git / formFieldvalue_vs_formData.md
Created December 26, 2016 18:10
(あとで書く)textareaのvalueメソッド vs textareaが属するformをFormDataに突っ込んでからvalueを取得する

(あとで書く)textareaのvalueメソッド vs textareaが属するformをFormDataに突っ込んでからvalueを取得する

要点

  • 改行コードが異なる
    • 前者はLF(改行)のみ
    • 後者はLF(改行)CR(復帰)
  • となる

検証

https://jsbin.com/zarodixota/edit?html,js,console,output