Skip to content

Instantly share code, notes, and snippets.

@wlt
wlt / gist:7094cf970b28cae7d1df
Created May 31, 2015 08:43
「1時間以内に解けなければプログラマ失格となってしまう5つの問題」の「問題5」を解いた
// 「1時間以内に解けなければプログラマ失格となってしまう5つの問題」の「問題5」を解いた
//
// 1時間以内に解けなければプログラマ失格となってしまう5つの問題が話題に
// http://www.softantenna.com/wp/software/5-programming-problems/
//
// 総当たりしてevalするだけ。
// 総当たりの生成には、結合子「+, -, 無し」の組み合わせを、3進数の各桁として扱うような方法をとっている
function p5() {
let values = [1,2,3,4,5,6,7,8,9];
@wlt
wlt / statusbar1.vimp
Created May 28, 2013 00:40
Vimperatorのステータスバーに何か表示するサンプル
" ステータスバーにページタイトル表示
autocmd LocationChange .* -js statusline.updateField("title", "{" + buffer.title + "}")
autocmd DOMLoad .* -js args.url == buffer.URL && statusline.updateField("title", "{" + buffer.title + "}")
set status^=title
" ステータスバーにタブグループ名表示
autocmd LocationChange .* -js setTimeout(function () { statusline.updateField("tabgrouptitle", "<" + tabGroup.tabView.GroupItems.getActiveGroupItem().getTitle() + ">") }, 0);
set status^=tabgrouptitle
@wlt
wlt / follow_windows_shortcut_file.patch
Last active December 17, 2015 16:09
Vimperator 3.7.1 に、、:sourceコマンドがWindowsのショートカットファイルの参照先ファイルを読み込む機能を追加するパッチ
diff -r 78a478c41da9 common/content/io.js
--- a/common/content/io.js Wed May 22 20:37:00 2013 +0200
+++ b/common/content/io.js Thu May 23 23:10:04 2013 +0900
@@ -19,15 +19,19 @@
plugins.contexts[file.path] = this;
this.NAME = file.leafName.replace(/\..*/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase());
this.PATH = file.path;
+ this.TARGET = file.getTarget();
this.toString = this.toString;
this.__context__ = this;
@wlt
wlt / README.md
Created April 19, 2013 06:55
Vimperatorの'encoding'オプションが機能してなかったので修正

症状

  1. 補完の問題
:setlocal encoding=

と入力しても補完が表示されない。(「Generating results...」のまま) エラーメッセージ「TypeError: options.getPref(...) is null」 2. 設定の問題

:setlocal encoding=UTF-8
@wlt
wlt / util.js.patch
Last active December 16, 2015 05:29
メソッドutil.xmlToDomForTemplateが常に、2n+1番目のノードのみを返す問題の修正
# HG changeset patch
# User wlt_lain <wltlain@gmail.com>
# Date 1366000762 25200
# Node ID b39b4cdbf57003cfb730f1722ebe9e18f7d33375
# Parent cc470b88dfb692ca10dcb33fe3c4c7d3978dc2db
fix: util.xmlToDomForTemplate
diff -r cc470b88dfb6 -r b39b4cdbf570 common/content/util.js
--- a/common/content/util.js Sat Apr 13 19:34:16 2013 +0900
+++ b/common/content/util.js Sun Apr 14 21:39:22 2013 -0700
@wlt
wlt / ldrize_cooperation.js
Created June 13, 2011 02:02
Greasemonkey 0.9.5でもldrize_cooperationがちょっと動くようにする
// Vimperator plugin: 'Cooperation LDRize Mappings'
// Version: 0.25
// Last Change: 09-Jun-2011. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
// Cooperation LDRize Mappings for Vimperator
//
// Variables:
// g:ldrc_captureMapping
@wlt
wlt / fix_toolbars_menu.patch
Created February 16, 2011 03:17
fix: "set toolbars=menu" behavior didn't conform with Firefox decide what to do.
diff -r 484fafc733a2 common/content/liberator.js
--- a/common/content/liberator.js Mon Feb 14 20:51:50 2011 +0900
+++ b/common/content/liberator.js Wed Feb 16 11:44:13 2011 +0900
@@ -1229,12 +1229,12 @@
if (!elem)
continue;
- elem.collapsed = collapsed;
-
// Firefox4 added this helper function, which does more than
@wlt
wlt / openURL.js
Created February 8, 2011 01:22
Limechatスクリプト:チャンネルログに現れるURLを開くコマンドを提供する
/* 書式: /u [Number]
* チャンネルログに現れる下からNumber番目のURLを開く
* Numberを省略すると1とみなす
*/
(function() {
var MAX = 10;
var urlsInChannels = {};
function getUrls(channelName)
{