Skip to content

Instantly share code, notes, and snippets.

@littlefolk
littlefolk / gist:666131
Created November 7, 2010 13:48
Rakefile: gitmodules update.
require "iniparse"
document = IniParse.parse(File.read(".gitmodules"))
document.each do |line|
desc "git-pull #{line.key}"
task line["path"] do
cd line["path"] do
sh "git pull" do |ok, res|
if ok
sh "git log HEAD@{1}..HEAD --reverse --oneline"
end
@littlefolk
littlefolk / gist:608064
Created October 2, 2010 22:38
Python's Inner function getattr questions?
class Foo:
def getattr(self, arg):
def x():
return "good"
return getattr(self, arg, None)
def x(self):
return "bad"
f = Foo()
@littlefolk
littlefolk / config.py
Created September 24, 2010 07:57
enthumble for keyhac
from keyhac import *
import itertools
"""
enthumble for keyhac
====================
enthumble_ 多機能バージョンのキーマップをkeyhacで再現してみる。
実装状況
@littlefolk
littlefolk / gist:585533
Created September 18, 2010 09:51
cuteExec from keyhac
from keyhac import *
import pyauto
def cuteExec(filename, param=u"", directory=u"", classname=u""):
def _cuteExec():
window = pyauto.Window.find(classname, None)
if window:
if window.isMinimized():
window.sendMessage(pyauto.WM_SYSCOMMAND, pyauto.SC_RESTORE)
window.setForeground(True)
// Util {{{1
let toggleDisplay = function (elem) elem && (elem.style.display = ((elem.style.display == "none")? "": "none"));
let Logger = libly.$U.getLogger("pixiv_tools.js");
let $ = function (a) window.content.document.getElementById(a);
let $LX = function (a, b) libly.$U.getFirstNodeFromXPath(a, b);
let $LXs = function (a, b) libly.$U.getNodesFromXPath(a, b);
let toQuery = function (so) [encodeURIComponent(i) + "=" + encodeURIComponent(so[i]) for (i in so)].join("&");
let checkInput = function (input) commandline.close() || (input && /^y(es)?/i.test(input));
// }}}1
@littlefolk
littlefolk / gist:467946
Created July 8, 2010 12:27
vimperator plugin: browser_object_api.js + tabBlocks
liberator.plugins.Block = function () {
let mTabs = Array.filter(config.tabbrowser.mTabs, function (aNode) aNode.localName == "tab");
let mCurrentIndex = tabs.index();
let identify = function (i) {try{return i.linkedBrowser.contentDocument.location.host}catch(e){}};
let tabBlocks = [], activeBlockIndex, cache;
mTabs.forEach(function (aTab) {
let id = identify(aTab);
if (cache != id && !TreeStyleTabService.getParentTab(aTab)) {
tabBlocks.push([]);
cache = id;
// Echo Statusline-field-url {{{
// ステータスバーを隠している時に、URL表示を確認する
mappings.addUserMap(
[modes.NORMAL], ['<C-g>'],
'Print the current url status',
function () liberator.echo(statusline._urlWidget.value),
{}
);
// }}}
@littlefolk
littlefolk / bartab-integration.js.patch
Created June 15, 2010 19:33
vimperator plugin patch: bartab-integration.jsをBarTab 2.0でも動くように
diff --git a/bartab-integration.js b/bartab-integration.js
index 3878e46..69b5c55 100644
--- a/bartab-integration.js
+++ b/bartab-integration.js
@@ -38,7 +38,7 @@ function barTap_bufferCompletion (context) {
<span highlight="Indicator" style="display: inline-block; width: 2em; text-align: center">{item.item.indicator}</span>
{ process.call(this, item, text) }
</>];
- context.completions = util.map(tabs.browsers, function ([i, browser]) {
+ context.completions = util.map(util.Array.iteritems(gBrowser.mTabs), function ([i, browser]) {
@littlefolk
littlefolk / loadedtab.js
Created June 10, 2010 18:11
vimperator plugin: previous tab *loaded*
// 次の未読タブへ移動 {{{
// @http://gist.github.com/433387
(function(){
if (liberator.plugins.browser_object_api) {
[
[
['gj', 'sj'], 'Go to the next tab *loaded*.',
function (count) {
tabs.select(
(
@littlefolk
littlefolk / evernote.js
Created June 9, 2010 09:12
vimperator plugin: evernote
// :evernote --- Post Evernote {{{
if (liberator.hasExtension("Evernote Web Clipper"))
commands.addUserCommand(["ev[ernote]"], "Post Evernote", evernote_addToEn3, {}, true);
// }}}