Skip to content

Instantly share code, notes, and snippets.

View metafeather's full-sized avatar

Liam Clancy metafeather

View GitHub Profile
#Most useful for providing a consistent uid on machines accessing an NFS mount:
$ sudo find . -xdev -user <old-uid> -print -exec chown <new-uid> {} \;
<!-- Use to include properties per OS -->
<property file="${antutil.includes}/${os.name}-${os.arch}.properties" />
# According to the manual page for ipconfig, this command appears to be unique to Mac OS X.
# The command will display a bunch of useful info, including:
# - server_identifier (ip): That's your DHCP server's IP address.
# - yiaddr: Your machine's IP address.
# - chaddr: Your machine's MAC address.
# - domain_name_server: Your domain name server(s).
ipconfig getpacket en0
# Sets the bell length to zero for all applications
setterm -blength 0
# Append the above to a Clearsilver generated page URL for a structured view of the template data.
?hdfdump=1
# Installing Subversion for local use is general an easy install, but allowing remote access to your svn repository over SSH can be problomatic dependent upon your OS and the means taken to install.
# For Darwinports and Fink on OS X the install location has to be added to users $PATHs, but there are extra steps outlined here for use of the svn+ssh means of access:
# http://subversion.tigris.org/faq.html#ssh-svnserve-location
# A much easier alternate is to sym link the svn binaries to a place on the default PATH (used by the SSH login):
# For MacPorts
ln -s /opt/local/bin/sv* /usr/bin/
/*
Using as a benchmark the task of iterating over a live collection produced by getElementsByTagName. IE/Win, Gecko and Safari all agree as to the fastest means - use a while loop and store the live collection in a variable:
*/
var i = 0, el, els = document.getElementsByTagName(nodeName);
while (el = els[i++]) {
// [...]
}
/*
I wanted a 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:
<!--
A quick code snippet to include the right XHTML DTD in your XSL generated output. This took me a bit of reseach to find out:
-->
<xsl:output
method="xml"
encoding="utf-8"
omit-xml-declaration="yes"
indent="no"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
@metafeather
metafeather / URL parsing Regex.js
Created October 6, 2009 12:35
URL parsing regex.js
/*
A single regex to parse and breakup a full URL including query parameters and anchors e.g.
https://www.google.com/dir/1/2/search.html?arg=0-a&arg1=1-b&amp;arg3-c#hash
*/
Url.regex = /^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/;
url: RegExp['$&'],
protocol: RegExp.$2,
host: RegExp.$3,