Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

« Newer Snippets
Older Snippets »
8 total  XML / RSS feed 

launch firefox ubuntu

first to find the big hex number
then to add it. Note the format of the command

xauth list
xauth add ubuntu/unix:0 . 8443108aff2df3cff0d91fa307ad3885

Increase the number of simultaneous XmlHttpRequests in Firefox

Firefox doesn't do a lot of simultaneous AJAX (or any kind of HTTP) requests. IE caps it at 2, too. This will allow you to test your XHR overload scripts, or just load pages faster in general.

1. Go to "about:config"
2. Find and edit the following
* network.http.pipelining=false
* network.http.pipelining.maxrequests=4
* network.http.proxy.pipeline=false
3. Make the false's true; I set my maxrequests at 20

Open Firefox in Safe Mode

// opens Firefox with extensions disabled. Also gives you the ability/option to reset Firefox to defaults.

// More info and code for other platforms can be found at http://kb.mozillazine.org/Safe_mode

/Applications/Firefox.app/Contents/MacOS/firefox -safe-mode

Disable Shift+Click selection in browsers

I wanted the table to allow the user to select a range of rows with a Shift+Click… The problem is that, by default, the browser will select the page’s text content. This isn’t something you’ll want to do very often but it is possible to get around this:

Firefox can do this from your CSS:

table {

    -moz-user-select: none;
}
On the table element IE needs:

the_table_node.onselectstart = function () {

    return false;
};

Fix Firefox search engine ordering

1. Type about:config at your Firefox address bar.
2. Type browser.search.order at the filter bar.
3. Change browser.search.order.1 to Google.

The new del.icio.us extension broke my search engine order... cheeky plugin placed itself #1

Getting rid of 'port has been disabled for security reasons' in Firefox

1. Type about:config at your Firefox address bar.
2. Right click -> Select 'New String' -> Type network.security.ports.banned.override
3. Enter your ports

I allow port 113 for various sundry firewall-related reasons

More info see: http://www.mozilla.org/projects/netlib/PortBanning.html

Clear form with Javascript

Purpose: Clear all text fields in a form

Other important features:
- Resulting page must be valid XHTML 1.1
- JS must work in Firefox 1.0 and MS Internet Explorer 6.0
- JS must never generate any errors, even non-fatal ones, in the Firefox Javascript Console
- JS should only clear text input (no hidden fields or visual controls)
- Code must be readable and properly indented

Looking around the web, this was not easy to find. After a few hours of searches, and some back'n'forth at Webmaster World, I got a working version.

In XHTML header:

<script type="text/javascript" src="clear-form-input.js">script>

In html/form/div

<script type="text/javascript">
  // CDATA[
    var el = document.createElement("input");
    el.setAttribute("id", "clearButton");
    el.setAttribute("type", "button");
    el.setAttribute("value", "Clear");
    document.getElementById("deliciousFormDiv").appendChild(el);
    addEvent(el, 'click', function(){ clearForm('delicious');} );
  // ]]>
script>

In clear-form-input.js:

function clearForm(formIdent) 
{ 
  var form, elements, i, elm; 
  form = document.getElementById 
    ? document.getElementById(formIdent) 
    : document.forms[formIdent]; 

        if (document.getElementsByTagName)
        {
                elements = form.getElementsByTagName('input');
                for( i=0, elm; elm=elements.item(i++); )
                {
                        if (elm.getAttribute('type') == "text")
                        {
                                elm.value = '';
                        }
                }
        }

        // Actually looking through more elements here
        // but the result is the same.
        else
        {
                elements = form.elements;
                for( i=0, elm; elm=elements[i++]; )
                {
                        if (elm.type == "text")
                        {
                                elm.value ='';
                        }
                }
        }
}
        
function addEvent(elm, strEvent, fnHandler)
{
        return ( elm.addEventListener
        ? elm.addEventListener( strEvent, fnHandler, false)
        : elm.attachEvent( 'on'+strEvent, fnHandler)
        );
}

proxy.pac file for Firefox / Mozilla / et. al.

Quite useful for mobile users who work at different locations and require different proxy server settings for each location, just point your Automatic Proxy Configuration URL to your local proxy.pac file and it automatically pics up if it should use a proxy server or not.

function FindProxyForURL(url, host)
{
   if (isPlainHostName(host) ||
       dnsDomainIs(host, ".foobar"))
       return "DIRECT";
    else
        if (isInNet(myIpAddress(), "192.168.99.0", "255.255.0.0"))
            return "PROXY 192.168.99.2:3128; DIRECT";
        else
            return "DIRECT";
}
« Newer Snippets
Older Snippets »
8 total  XML / RSS feed