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
// access window object from XUL | |
function pageLoaded(){ | |
alert("the page has been loaded") | |
} | |
window.addEventListener("load", function () { | |
gBrowser.addEventListener("load", pageLoaded, true); | |
}, false); |
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
// create XUL element | |
function createToolbarButton() { | |
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; | |
var anitem = document.createElementNS(XUL_NS, "toolbarbutton"); | |
anitem.setAttribute("id", "Testing-Doit-Button2"); | |
anitem.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional"); | |
anitem.setAttribute("label", "label"); | |
anitem.setAttribute("tooltiptext", "Do it!"); | |
anitem.setAttribute("oncommand", "testing_doit();"); | |
return anitem; |
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
<?php | |
// get the callee in PHP | |
$backtrace = debug_backtrace(); | |
return $backtrace[1]['function']; | |
?> |
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
// Mozilla preferences helper library | |
// Components.classes['@mozilla.org/preferences-service;1'] .getService(Components.interfaces.nsIPrefService) .savePrefFile(null); | |
var $Prefs = { | |
_getBranch : Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch), | |
_getService : Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService), | |
set : function(pref_name, pref_value) { | |
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); | |
str.data = pref_value.replace(/^\s*|\s*$/g,''); | |
(this._getBranch).setComplexValue(pref_name, Components.interfaces.nsISupportsString, str); |
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
// SQLite helper library for Mozilla | |
var $sqlite = { | |
storageService: [], | |
mDBConn: [], | |
_initService : function(file){ | |
var db = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); | |
db.append(file); | |
this.storageService[file] = Components.classes["@mozilla.org/storage/service;1"].getService(Components.interfaces.mozIStorageService); |
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
// Opening window/tab helper library for Mozilla | |
var $window = { | |
open_in_new_tab: function(url){ | |
getBrowser().selectedTab = getBrowser().addTab(url); | |
}, | |
open_in_same_tab: function(url){ | |
top.content.document.location = url; | |
}, |
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
// UTF8 encode/decode | |
var $utf8 = { | |
encode : function (string) { | |
string = string.replace(/\r\n/g,"\n"); | |
var utftext = ""; | |
for (var n=0, k=string.length; n < k; n++) { | |
var c = string.charCodeAt(n); | |
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
// Mozilla export coordinates to a .kml file (for Google Earth) | |
var $google = { | |
_exampleLocation : { | |
'name':'Tokyo', | |
'latitude':35.65444, | |
'longitude':139.74472 | |
// Other data: | |
//'heading' : 0 , | |
//'tilt' : 0 , |
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
2 exe communicating vb6 | |
project MainApp: | |
on the form place controls as follows: | |
place a frame on form, set the caption to frame1 = Communicate to Receiver | |
insert in frame1 a Text box, leave default name(Text1), set index to 0 | |
place another frame on form, set the caption to frame2 = Send This Message |
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
' wsh shell execute and return output | |
' MsgBox RunOutput("COMMAND /C DIR C:\", 0) | |
Function RunOutput(cProgram, nWindowType) | |
'-- Obtain a Temporary File Name | |
Dim oFS | |
Set oFS = CreateObject("Scripting.FileSystemObject") | |
Dim cFile | |
cFile = oFS.GetSpecialFolder(2).Path & "\" & oFS.GetTempName | |