Skip to content

Instantly share code, notes, and snippets.

@littlefolk
littlefolk / gist:1045958
Created June 25, 2011 00:41
Scriptish use sharedWindow
// ScriptishでもLDRizeが使えるように、Greasemonkey用のパッチを流用して適応。
// via.
// [Firefox 4.0b10でGreasemonkey 0.9.1のユーザスクリプトのwindowを共通にする改造(開発者orVimper向け) - wltの日記](http://d.hatena.ne.jp/wlt/20110130/1296359063)
// support.
// Greasemonkey 0.9.5
// Scriptish 0.1.1 - 0.1.4
javascript <<EOM
autocommands.add(
'VimperatorEnter', '.*',
function () {
@littlefolk
littlefolk / refcontrol.js.patch
Created May 7, 2011 09:01
vimperator plugin patch: refcontrol.js
diff --git refcontrol.js refcontrol.js
index 54261b3..7c36ab6 100644
--- refcontrol.js
+++ refcontrol.js
@@ -98,8 +98,8 @@ RefControl.prototype = {
panel.setAttribute('class', 'statusbarpanel-iconic');
panel.setAttribute('src', self.isEnable ? ENABLE_ICON : DISABLE_ICON);
panel.addEventListener('click', function(e) { self.isEnable = !self.isEnable; }, false);
- document.getElementById('status-bar').insertBefore(
- panel, document.getElementById('security-button').nextSibling);
@littlefolk
littlefolk / prevent-pseudo-domain.js.diff
Created April 1, 2011 09:21
vimperator plugin patch: prevent-pseudo-domain.js
diff --git a/prevent-pseudo-domain.js b/prevent-pseudo-domain.js
index 6cd3a71..65e1a8f 100644
--- a/prevent-pseudo-domain.js
+++ b/prevent-pseudo-domain.js
@@ -13,7 +13,7 @@
}
hasScheme = function(s) {
- return /^([a-zA-Z]+):\/\//i.test(s);
+ return /^([^:/?#]+):/.test(s);
@littlefolk
littlefolk / keywordlist_furigana2skkdic.rb.patch
Created February 22, 2011 02:57
keywordlist_furigana2skkdic.rb
--- keywordlist_furigana2skkdic.rb.org 2010-09-16 10:59:23.000000000 +0900
+++ keywordlist_furigana2skkdic.rb 2010-09-16 10:59:23.000000000 +0900
@@ -34,8 +34,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-require 'nkf'
-
class String
# borrowed from http://openlab.jp/skk/skk/tools/filters/skkdictools.rb
@littlefolk
littlefolk / gist:832657
Created February 17, 2011 20:51
twilight.vim custum
--- twilight.vim 2011-02-18 05:50:48.151998300 +0900
+++ twilight.vim.orig 2011-01-24 14:18:26.000000000 +0900
@@ -55,7 +55,7 @@
exe 'hi SpecialKey guifg='.s:grey .' guibg='.s:darkgrey
exe 'hi LineNr guifg='.s:mid_grey_blue .' guibg='.s:dark_grey_blue .' gui=none'
-exe 'hi StatusLine guifg='.s:white .' guibg='.s:grey .' gui=underline'
+exe 'hi StatusLine guifg='.s:white .' guibg='.s:grey .' gui=italic,underline'
exe 'hi StatusLineNC guifg='.s:lightgrey .' guibg='.s:grey .' gui=italic,underline'
exe 'hi VertSplit guifg='.s:grey .' guibg='.s:grey .' gui=none'
@littlefolk
littlefolk / _vimrc
Created February 4, 2011 10:10
insert position start at topline
let g:changelog_new_entry_format = "\n\t* %c"
@littlefolk
littlefolk / twilight.css
Created January 25, 2011 04:17
user styles
/* via. [twilight : A clone of Textmates twilight scheme](http://www.vim.org/scripts/script.php?script_id=1677) */
tabpanels {
background-color: #1a1a1a !important;
}
@-moz-document url-prefix(http://), url-prefix(https://), url-prefix(ftp://), url-prefix(file://) {
*:not(:empty) {
color: #fffedc !important;
border-color: #303030 !important;
@littlefolk
littlefolk / gist:791161
Created January 22, 2011 14:46
Longest Common Substring
// via. http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_substring#Python
function LCSubstr_str(S, T) {
var m = S.length, n = T.length;
var L = [], ml = m + 1, nl = n + 1;
for (var i = 0; i < ml; i++) {
var l = [];
for (var j = 0; j < nl; j++) {
l.push(0);
};
L.push(l);
@littlefolk
littlefolk / gist:788723
Created January 20, 2011 21:35
javascript#each_cons
// https://developer.mozilla.org/ja/New_in_JavaScript_1.7#Array_comprehensions
function range (begin, end) {
for (let i = begin; i < end; ++i) {
yield i;
}
};
// http://code.activestate.com/recipes/347689-ruby-arrayeach_cons-each_slice-overlapping-and-non/
function each_cons (l, n) {
return [l.slice(i, i + n) for (i in (range(0, l.length - n + 1)))]