Skip to content

Instantly share code, notes, and snippets.

@gooocho
gooocho / casperjs.bat
Created December 11, 2012 10:42
casper on windows
@ECHO OFF
set CASPER_PATH=%~dp0..\
set CASPER_BIN=%CASPER_PATH%bin\
set PHANTOMJS_NATIVE_ARGS=(--cookies-file --config --debug --disk-cache --ignore-ssl-errors --load-images --load-plugins --local-storage-path --local-storage-quota --local-to-remote-url-access --max-disk-cache-size --output-encoding --proxy --proxy-auth --proxy-type --remote-debugger-port --remote-debugger-autorun --script-encoding --web-security)
set PHANTOM_ARGS=
set CASPER_ARGS=
:Loop
■HTML風文字列
"<ul><li><ul><li></li><li>"
といった文字列.
"<"と">"が多いなー、という風に認識している程度で、どこまでが1番目のul要素なのかはまだわかりません.
■DOM Tree
HTML風文字列を
・省略された閉じタグの補完
・不正なHTMLの修正
・コメントの解釈
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open('http://localhost/test.html', function (status) {
// Check for page load success
if (status !== "success") {
console.log("Unable to access network");
} else {
// Execute some DOM inspection within the page context
(function(w) {
var model = {
getDetail: function(callback) {
$.getJSON('./detail.json')
.done(function(data) {
callback(data);
});
}
};
@gooocho
gooocho / .ctrl_exchange_en.nodoka
Last active November 24, 2016 22:57
nodokaの設定ファイルないと作業効率が半分くらいになる
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 窓使いの憂鬱 - dot.mayu
# Copyright (C) 1999-2005, TAGA Nayuta <nayuta@users.sourceforge.net>
#
include "109.nodoka"
include "104on109_edited.nodoka" # 109 keyboard 上で 104 keyboard 風に動かす
mod control += 英数 # 英数を Control に
key *英数 = *LControl # 〃
@gooocho
gooocho / sprintf.js
Last active December 19, 2015 16:38
underscore.stringのsprintf http://www.diveintojavascript.com/projects/javascript-sprintf も qiitaで紹介されてたsprintf http://homepage3.nifty.com/aya_js/js_sub/sprintf.js も仕様 http://linuxjm.sourceforge.jp/html/LDP_man-pages/man3/printf.3.html を全然満たしてないので自分で作った あとでもう少し直す/テスト書く
var sprintf = (function(isModerate) {
function lpad(str, len, ch) {
str = String(str);
len = ~~len;
ch = String(ch);
if (str.length > len) {
return str;
}
return ((new Array(len + 1).join(ch)) + str).slice(-len);
@gooocho
gooocho / espowerun.cmd
Created August 23, 2013 09:08
azu さんのespowerun.jsをキックするwindows用シェルスクリプト c.f. https://gist.github.com/azu/6309397
@echo off
if "%1"=="" (
echo "Usage: ./espowerun.cmd path/to/test.js"
exit
)
set tmpname=
set tmpdir=
FOR /L %%i IN (0 1 100) DO (
// referring:
// https://github.com/itbaby/brackets-expand-selection-to-quotes/blob/master/main.js
define(function(require,exports,module){
var AppInit = brackets.getModule('utils/AppInit'),
KeyBindingManager = brackets.getModule('command/KeyBindingManager'),
CommandManager = brackets.getModule('command/CommandManager'),
EditorManager = brackets.getModule('editor/EditorManager');
var EXPAND_SELECTION_TO_QUOTES = 'Expand selection to quotes',
CMD_SELECT_TO_QUOTES = 'quotes.select';
@gooocho
gooocho / tower-defence.js
Last active July 7, 2017 12:48
とりあえず
var gameMap;
(function() {
'use strict';
const startTime = Date.now();
const MOVE = {
walk: 'WALK',
fly: 'FLY',
class Cell {
constructor(token, x, y) {
this.token = token;
this.x = x;
this.y = y;
}
}
class FillMap {
static emptyMap(width, height) {