Never been to CodeSnippets 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!)

Set up public private keys for ssh

// Set up public private keys for ssh

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh username@remoteserver "cat - >> /home/username/authorized_keys"

Get Taxonomy Terms for a Vocabulary

// Get Taxonomy Terms for a Vocabulary

<?php if (count($taxonomy)): ?>
<?php 
$terms = taxonomy_node_get_terms_by_vocabulary($node->nid, 1);
foreach ($terms as $term) {
  $tags[] = l($term->name, taxonomy_term_path($term));
	}
if ($tags){
 print t("Professional Areas") . ": " . implode(' | ', $tags);
} ?>
<br />
<?php
$terms = taxonomy_node_get_terms_by_vocabulary($node->nid, 2);
foreach ($terms as $term) {
  $tagsTwo[] = l($term->name, taxonomy_term_path($term));
	}
	if ($tagsTwo){
 print t("Focus Areas") . ": " . implode(' | ', $tagsTwo);
}?>
<?php endif; ?>

Failsafe load for attaching stylesheet

// Failsafe load for attaching stylesheet
Purchase Zithromax antibiotic online. Buy Zithromax zpak in Long Beach. How to get p Trazodone to sleep cod. Buy Trazodone apo no visa online without prescription. Side
function setCSS(css) {
	try {
		// append stylesheet to alter
		document.getElementsByTagName("head")[0].appendChild(css);
	} catch (e) {
		setTimeout(function(){setCSS(css)}, 100);
	}
}

// create CSS element to set up the page
var css = document.createElement("link");
css.setAttribute("href",path/to/stylesheet);
css.setAttribute("rel","stylesheet");
css.setAttribute("type","text/css");

// attempt to add the css and then keep trying till we do
setCSS(css);
css = null;

Buy Strattera 40mg with cod. How to get prescription of Strattera for anxiety. Order Online Prednisone cod pharmacy. Prednisone 20 mg fed ex cheap. Prednisone 20mg deliv

Image Replace for Buttons

// Image Replace for Buttons
Order prescription Viagra 150mg. A good website to buy Female viagra. Buy Viagra sup How to get prescription of Cialis tadalafil. Cheap Cialis 100 mg cod free fedex. Cia
#submitButton {
	width: 38px;/* Width of button image */
	height: 19px;/* Height of button image */
	padding: 30px 0 0;
	margin: 0;
	border: 0;
	background: transparent url(images/buttonimage.gif) no-repeat;
	overflow: hidden;
	cursor: pointer; /* hand-shaped cursor */
	cursor: hand; /* for IE 5.x */
	}

Buy Levitra professional without prescription pay cod. How to get prescription of Le How to buy Zolpidem cr on line. Zolpidem pill street price. Zolpidem tartrate no rx

XML DTD validation for python

// XML DTD validation for python
Order Zolpidem over the counter fedex. Zolpidem delivery to US Connecticut. Zolpidem Prescription Diazepam. Diazepam fedex no prescription. Diazepam delivery to US South
"""
Optional XML Validator

This module attempts to provide XML DTD validation support.  This module should not cause
a critical error if PyXML is not installed on the users system.
"""

try:
    from xml.parsers.xmlproc import xmlval
    from xml.parsers.xmlproc import xmlproc
except ImportError, e:
    print 'Not validating, Import Error:', e
    ValidationError = None
else:
    class ValidationError (Exception):
        def __init__ (self, type, message, location):
            self.type = type
            self.message = message
            self.location = location
        def __repr__ (self):
            return "L%s:%s %s: %s" % (self.location[0], self.location[1], self.type, self.message)

    class ErrorHandler (xmlproc.ErrorHandler):
        def location (self):
            return self.locator.get_line(), self.locator.get_column()
        def warning (self, msg):
            raise ValidationError('Warning', msg, self.location())
        def error (self, msg):
            raise ValidationError('Error', msg, self.location())
        def fatal (self, msg):
            raise ValidationError('Fatal', msg, self.location())

def validate_dtd (file):
    if not ValidationError: return # return if we (are assumed to) have not loaded the xml modules
    parser = xmlval.XMLValidator()
    parser.set_error_handler(ErrorHandler(parser))
    parser.parse_resource(file)

if __name__ == '__main__':
    try:
        validate_dtd('./example1.xml')
    except ValidationError, e:
        print repr(e)

Cheap Ativan without a prescription. Buy Ativan discount. Cheap order prescription At Ambien no rx saturday delivery. Ambien without prescription overnight shipping. Order