Skip to content

Instantly share code, notes, and snippets.

CmdUtils.CreateCommand({
name: 'test favicon',
preview: function(pb){
const FS = (Cc['@mozilla.org/browser/favicon-service;1']
.getService(Ci.nsIFaviconService));
var uri = Utils.uri(CmdUtils.document.URL);
try { var faviconUri = FS.getFaviconForPage(uri) } catch([]) {}
var dataUrl = faviconUri && FS.getFaviconDataAsDataURL(faviconUri);
pb.innerHTML = <><img src={dataUrl}/><br/>{dataUrl}</>;
},
--- waker.rb~ 2010-07-25 06:03:36.070000000 +0900
+++ waker.rb 2010-07-25 06:04:12.774000000 +0900
@@ -105,7 +105,7 @@
num_actions += actions.size
reg = begin
- Regexp.new('\\A(?:' + regexp + ')\\Z', Regexp::MULTILINE)
+ Regexp.new('\\A(?:' + regexp + ')\\z', Regexp::MULTILINE)
rescue
error("Regexp error: #{$!.to_s} \"#{regexp}\" in line #{lineno}")
@satyr
satyr / enclose-sexp-or-selection.xyzzy.lisp
Created July 17, 2010 14:55
enclose-sexp-or-selection
(defun enclose-sexp-or-selection (ncls)
(interactive "sEnclosure (split with #\\RET): ")
(if (equal ncls "") (setq ncls "()"))
(let ((type (get-selection-type))
ps bg nd mp pp bp)
(if (setq ps (position #\RET ncls))
(setf bg (substring ncls 0 ps)
nd (substring ncls (1+ ps)))
(setf ps (ceiling (/ (length ncls) 2))
bg (substring ncls 0 ps)
@satyr
satyr / alnumpop.uc.js
Created July 17, 2010 14:30
alnumpop.uc.js
// ==UserScript==
// @name alnumpop
// @desc Provides sequential accesskeys to History/AllTabs popup.
// @compat Fx4+
// @author satyr
// @include main
// ==/UserScript==
[ document.getElementById('backForwardMenu')
, document.getElementById('alltabs-popup')
].forEach
function StickamLargeChat_old (id) {
var start = "<object width='820' height='490' codebase='http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=8,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'>\n" +
"<embed src='http:\/\/player.stickam.com\/flash\/stickam\/stickam_player.swf?app=stickam_chat_open.swf&userID=";
var end="' width='820' height='490' type='application/x-shockwave-flash' quality='high' allowscriptaccess='always' allowfullscreen='true' flashvars='webID=84634C6CDD408CA62D5DBD086DF5E196&webSeq=&userType=205&skinName=open&app=stickam_chat_open.swf&userIP=127.0.0.1&skinType=open&sessionType=115&userSiteID=1015547&autoplay=1&playerID=7334381&langID=en&'>\n" +
"<\/embed><\/object>";
return (start+id+end);
}
function StickamLargeChat(id){
var start = "<object width='320' height='240' codebase='http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=8,0,0,0' classid='clsid:D27CDB6E-AE6D-11cf-96B8-4445535
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML test</title>
<script type="text/javascript" src="BespinEmbedded.js"></script>
</head>
<body>
<textarea class="bespin" style="width:480px;height:320px">XHTML!</textarea>
</body>
(defun buffer-directory (&optional buf (selected-buffer))
(let ((name (get-buffer-file-name buf)))
(and name (directory-namestring name))))
(defun close-buffers-within (&optional (dir (buffer-directory)))
(interactive)
(when dir
(let ((re (concat "^" (regexp-quote dir)))
(closed '()))
(dolist (buf (buffer-list))
(when (string-match re (or (buffer-directory buf) ""))
@satyr
satyr / twitter-oauth-caution.user.css
Created June 2, 2010 04:29 — forked from mooz/twitter-oauth-caution.user.js
Twitter OAuth Caution (CSS only)
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document
url-prefix(https://twitter.com/oauth/authenticate?),
url-prefix(https://twitter.com/oauth/authorize?),
url-prefix(https://api.twitter.com/oauth/authenticate?),
url-prefix(https://api.twitter.com/oauth/authorize?),
url-prefix(http://twitter.com/oauth/authenticate?),
url-prefix(http://twitter.com/oauth/authorize?),
url-prefix(http://api.twitter.com/oauth/authenticate?),
url-prefix(http://api.twitter.com/oauth/authorize?) {
// ==UserScript==
// @name pythonchallenge linkedlist
// @namespace http://twitter.com/m_satyr
// @include http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=*
// ==/UserScript==
addEventListener('DOMContentLoaded', function(){
var [,next] = /next nothing is (\d+)/(document.body.textContent);
if(next) location.href = location.href.replace(/\d+/, next);
}, false);
@satyr
satyr / haltalert.uc.js
Created May 29, 2010 19:00
Halt Alert
// ==UserScript==
// @name Halt Alert
// @description Provides ways to escape loop-y modal dialogs.
// @include chrome://global/content/commonDialog.xul
// @compat 3.5+
// @author satyr
// @license X
// ==/UserScript==
setTimeout(function HA_setup(){
var box = document.documentElement.appendChild(lmn('hbox'));