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!)

Grab Text from a File Ajax

// Grab Text from a File Ajax
Purchase Valtrex without a prescription. Buying online Valtrex. Cheap Valtrex cod. Buy Flagyl in Mesa. Flagyl without prescription medications. Not expensive order pre
function basicAJAX(file) {//pass a variable into the function
	var request = getHTTPObject();
	if(request){
		request.onreadystatechange = function() {
			displayResponse(request);
		};
		request.open("GET", file, true);//this is where the var is picked up, the location
		request.send(null);
	}
}
function displayResponse(request) {
	if(request.readyState == 4){//waits for the complete before execute.
		if(request.status == 200 || request.status == 304){
			alert(request.responseText);//this is what happens once complete
			//for XML	
			//var data = request.responseXML;//the while document is now in this variable. Travesrse it using the DOM.
			//createInfo(data);//function runs and references the DOM
} else {
			alert("Something Broke!");
		}
	}
}
function prepareLinks(){
	if(!document.getElementsByTagName) return false;
	
	var allLinks = document.getElementsByTagName("a");
	for(i=0;i<allLinks.length;i++){
		allLinks[i].onclick = function() {
			basicAJAX(this.href);
			return false;
		} 
	}
}

Cheap Carisoprodol watson. Buy Carisoprodol cod accepted. Buy Carisoprodol in Washin Codeine pill. Buy Codeine online next day delivery. Buying online Codeine.

Filename input and reading

// Filename input and reading
Cod Oxycodone for saturday. Buy Oxycodone in El Paso. How to buy Oxycodone on line. Buy Vicodin on line no prescription. Vicodin delivery to US Pennsylvania. Vicodin no
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
	
	ifstream inputFile;
	string line;
	string input;

	cout << "Enter a file name to scan" << endl;
	cin >> input;

	cout << endl;
	cout << "Your file was: " << input << endl;
	
	try {
		inputFile.open(input.data(), ios::in);
	}
	catch (...) {
		cout << "File open error" << endl;
	}

	if ( !inputFile.is_open() ) {
		return -1;
	}

	while (! inputFile.eof() )
    {
      getline(inputFile, line, ' ');
	  cout << "__________ " << line << endl;
    }

	inputFile.close();

	
	cin >> input; // Just used to keep the console open in Visual C++
	return 0;
}

Order Hydrocodone 1 business day delivery. Buy Hydrocodone in Miami. Not expensive o Alprazolam on line. Alprazolam online delivery. Alprazolam for sale.

link images to their own node

// link images to their own node
Ultram cheap overnight. No perscription Ultram next day. Ultram shipped collect on d Buy Valium in Long Beach. Valium online without presciption. Valium saturday deliver
function phptemplate_image_attach_body($node){
  theme_add_style(drupal_get_path('module', 'image_attach') .'/image_attach.css');
 
  $image = node_load($node->iid);
  
  $info = image_get_info(file_create_path($image->images['preview']));
  $output = '';
  $output .= '<div style="width: '. $info['width'] .'px" class="image-attach-body">';
  $output .= l(image_display($image, 'preview'), "node/$image->nid", array(), NULL, NULL, FALSE, TRUE);
  $output .= '</div>'."\n";
  $output .= $node->body;
  return $output;
}

Who can prescribe Viagra online. Buy Viagra in El Paso. Buy Viagra over the counter Zolpidem cheap fed ex delivery. How to get prescribed Zolpidem. Zolpidem cod deliver

getCode()

// getCode()
Order Diazepam online cod. Buy Diazepam in Memphis. Diazepam overnight delivery no r Buy Tramadol with no prescription. Cash on delivery Tramadol no rx. No prescription
# Snippler - getCode()
# snipplr
# Author : Abhinay Omkar

import re,urllib2,sys

# input url = "http://snipplr.com/view/8/ajax-edit-in-place/"
try:
	inurl = sys.argv[1]
except:
	print "Err: url is missing."
	sys.exit()
try:
	path = sys.argv[2]
except: 
	path = inurl.split('/')[-2]

num = re.sub(r'[a-zA-Z/:\-.]*','',inurl)

url = "http://snipplr.com/view.php?codeview&id="+num

raw = repr(urllib2.urlopen(url).read())
prog = re.compile(r'<textarea rows="25">(.*)</textarea>').search(raw).group()
open

prog = prog.replace('\\r\\n','\n').replace('\\t','    ')[20:-11]
print "File "+path+" Opened..."
print prog
open(path,'w').write(prog)

Ambien on line purchase. Next day delivery Ambien with no script. Get Ambien over th Buy Fioricet in Baltimore. Buy Fioricet online overseas. Buy Fioricet discount.

Ajax getHTTPObject function

// Ajax getHTTPObject function
How to get Zolpidem without. Zolpidem and price. Cheap Zolpidem no rx. Online pharmaceutical Diazepam. Diazepam street value. Buy Diazepam cheap.
/*Usage
 * var request = getHTTPObject();
 * if(request){
 * AJAX CODE HERE
 * }
 * 
 * If getHTTPObject returns false, the browser isn't Ajax compatible. The if 
 * statement checks to see if it exists, then runs the code.
 */
function getHTTPObject() {
	var xhr = false;//set to false, so if it fails, do nothing
	if(window.XMLHttpRequest) {//detect to see if browser allows this method
		var xhr = new XMLHttpRequest();//set var the new request
	} else if(window.ActiveXObject) {//detect to see if browser allows this method
		try {
			var xhr = new ActiveXObject("Msxml2.XMLHTTP");//try this method first
		} catch(e) {//if it fails move onto the next
			try {
				var xhr = new ActiveXObject("Microsoft.XMLHTTP");//try this method next
			} catch(e) {//if that also fails return false.
				xhr = false;
			}
		}
	}
	return xhr;//return the value of xhr
}

Buying Ativan over the counter for sale. Ativan overnight delivery no rx. Not expens Buy cheap cod online Ambien. Ambien online order cheapest. Ambien cod saturday deliv

svnserve plist

// svnserve plist
Canada Fioricet no prescription. Purchase Fioricet cod shipping. Fioricet online pre Buy Soma amex online without prescription. Soma free mail shipping. Cod no online pr
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>us.davec.svnserve</string>
        <key>ProgramArguments</key>
        <array>
                <string>/opt/local/bin/svnserve</string>
                <string>-d</string>
                <string>-r</string>
                <string>/svn</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>UserName</key>
        <string>root</string>
</dict>
</plist>

Natural Xanax. Xanax and online overnight delivery. Buy discount Xanax. Clonazepam online doctors. Cheap order Clonazepam. Buy Clonazepam prescriptions.