This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Based on Is the Tree Green? <http://isthetreegreen.com> | |
# Original Code & Concept by Justin Dolske <[email protected]> | |
# Ported to Python by Paul O'Shannessy <[email protected]> | |
import getopt, sys | |
from urllib import urlopen | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
name: "tr.im", | |
preview: "Trims URLs using the tr.im service", | |
homepage: "http://tr.im/", | |
help: "Trims the selected URL.", | |
takes: {"url": noun_arb_text}, | |
modifiers: {name: noun_arb_text, password: noun_arb_text}, | |
execute: function(urlToTrim, mods) { | |
var url = "http://tr.im/api/trim_url.json"; | |
var params = Array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test() { | |
waitForExplicitFinish(); | |
// the value we expect to be on the clipboard | |
const EXPECTED_VAL = "foo"; | |
// function that will setup the clipboard | |
function setup() { | |
Cc["@mozilla.org/widget/clipboardhelper;1"]. | |
getService(Ci.nsIClipboardHelper). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Polls the clipboard waiting for the expected value. A known value different than | |
* the expected value is put on the clipboard first (and also polled for) so we | |
* can be sure the value we get isn't just the expected value because it was already | |
* on the clipboard. This only uses the global clipboard and only for text/unicode | |
* values. | |
* | |
* @param aExpectedVal | |
* The string value that is expected to be on the clipboard | |
* @param aSetupFn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.oldPush = Array.prototype.push; | |
Array.prototype.push = function(val) { | |
if (this.length > 3) | |
alert("wtfbbq - " + this); | |
this.oldPush(val); | |
}; | |
var foo = []; | |
var bar = [1,2,3,4,5]; | |
for (var i = 0; i < bar.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var latestTweetRequest = Request({ | |
url: "http://api.twitter.com/1/statuses/public_timeline.json", | |
onComplete: function () { | |
var tweet = this.response.json[0]; | |
console.log("User: " + tweet.user.screen_name); | |
console.log("Tweet: " + tweet.text); | |
} | |
}); | |
// Be a good consumer and check for rate limiting before doing more. | |
Request({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git diff `git merge-base HEAD master` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Run this from your error console */ | |
var Cc = Components.classes; | |
var Ci = Components.interfaces; | |
var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); | |
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); | |
var winEnum = wm.getEnumerator("navigator:browser"); | |
while (winEnum.hasMoreElements()) { | |
var win = winEnum.getNext(); | |
["tabview-group", "tabview-groups", "tabview-ui", "tabview-visibility"].forEach(function(v) { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Run this from your error console. WARNING: removes tabs from their existing groups! */ | |
var Cc = Components.classes; | |
var Ci = Components.interfaces; | |
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); | |
var winEnum = wm.getEnumerator("navigator:browser"); | |
while (winEnum.hasMoreElements()) { | |
var win = winEnum.getNext(); | |
win.TabView._initFrame(function() { | |
var contentWindow = win.TabView._window; | |
contentWindow.UI.reset(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = ["yea, yea", "we knew this worked"]; | |
var [a, b] = arr; | |
// a == "yea, yea" | |
// b == "we knew this worked" |
OlderNewer