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

Send texmate selection to Quicksilver

// Send texmate selection to Quicksilver
Zolpidem canada cheap overnight delivery. Buy Zolpidem ambien in Miami. Overnight Zo Generic diazepam without doctor rx. Diazepam 10 mg legal FDA DEA approved. Not expen
#!/bin/bash
#
# Sends the current selection text or document (if no selection) to quicksilver 
# To use this you must install the "Command Line Tools (qs)" plugin in quicksilver
#
# Create a new bundle command and call it "Send to Quicksilver"
# Set command input to Selection Or Document
# set command output to discard
# set key equivalent (I set mine to command + escape)
# Leave Scope Selector blank

cat /dev/stdin | qs

Ativan sublingual delivery to US Rhode Island. Ativan 1 mg cost. Ativan tablets fede Buy Ambien pill in Louisville. Ambien cr order a prepaid mastercard. Buy Ambien zolp

Send multi-part encoded mail with attachments

// Send multi-part encoded mail with attachments
Buy cheap 2 mg klonopin overnight. Buy Klonopin 1 mg free next day air. Klonopin clo Ultram er 100 mg shipped by cash on delivery. Generic ultram regular supply. Buy Ult
/**
 * Sends mail to the e-mail address given.
 * Supports attaching files and multiple encodings.
 * @param string The email address of the recipient
 * @param string The name to include in the from header
 * @param string The e-mail address to include in the from header
 * @param string the e-mail subject
 * @param string the e-mail body.
 * @param boolean true if the body is html or false if plain text.
 * @param string a path to a file on the server to attach to the e-mail. Null or an empty string indicates that there is no attachment.
 * @param string the encoding with which to encode the subject, from, and body.
 */
function SendMail($emailaddress,
                   $from, $fromaddress,
                   $emailsubject="",
                   $body="", $html = true,
                   $attachment="",
                   $encoding="utf-8") {//{{{
  
  # Is the OS Windows or Mac or Linux
  if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
    $eol="
";
  } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
    $eol="\r";
  } else {
    $eol="\n";
  } 
  
  //set subject encoding
  if (!empty($emailsubject)) {
    $emailsubject = encode_mail_string($emailsubject, $encoding);
  }
  $from = encode_mail_string($from, $encoding);
  if ($encoding != "utf-8" && !empty($body)) {
    $body = mb_convert_encoding($body, $encoding, "utf-8");
  }
  
  $msg = "";
  
  # Common Headers
  $headers .= "From: ".$from." <".$fromaddress.">".$eol;
  $headers .= "Reply-To: ".$from." <".$fromaddress.">".$eol;
  $headers .= "Return-Path: ".$from." <".$fromaddress.">".$eol;    // these two to set reply address
  $headers .= "Message-ID: <".time()." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
  $headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters
  $headers .= 'MIME-Version: 1.0'.$eol;
  
  if (!empty($attachment)) {
    //send multipart message
    # Boundry for marking the split & Multitype Headers
    $mime_boundary=md5(time());
    $headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol;
    
    # File for Attachment
    
    $f_name = $attachment;
    $handle=fopen($f_name, 'rb');
    $f_contents=fread($handle, filesize($f_name));
    $f_contents=chunk_split(base64_encode($f_contents));//Encode The Data For Transition using base64_encode();
    $f_type=filetype($f_name);
    fclose($handle);
    
    # Attachment
    $msg .= "--".$mime_boundary.$eol;
    $msg .= "Content-Type: application/jpeg; name=\"".$file."\"".$eol;
    $msg .= "Content-Transfer-Encoding: base64".$eol;
    $msg .= "Content-Disposition: attachment; filename=\"".basename($attachment)."\"".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !!
    $msg .= $f_contents.$eol.$eol;
    # Setup for text OR html
    $msg .= "Content-Type: multipart/alternative".$eol;
    
    
    $contentType = "text/plain";
    if ($html) {
      $contentType = "text/html";
    }
  
    # Body
    $msg .= "--".$mime_boundary.$eol;
    $msg .= "Content-Type: ".$contentType."; charset=\"".$encoding."\"".$eol;
    $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !!
    $msg .= $body.$eol.$eol;
    
    # Finished
    $msg .= "--".$mime_boundary."--".$eol.$eol;  // finish with two eol's for better security. see Injection.
  } else {
    $headers .= "Content-Type: text/plain; charset=\"".$encoding."\"".$eol;
    $headers .= "Content-Transfer-Encoding: 8bit".$eol.$eol; // !! This line needs TWO end of lines !! IMPORTANT !!
    $msg .= $body.$eol.$eol;
  }
  
  // SEND THE EMAIL
  //LogMessage("Sending mail to: ".$emailaddress." => ".$emailsubject);
  
  //ini_set(sendmail_from, 'from@me.com');  // the INI lines are to force the From Address to be used !
  ini_set(sendmail_from, $fromaddress); //needed to hopefully get by spam filters.
  $success = mail($emailaddress, $emailsubject, $msg, $headers);
  ini_restore(sendmail_from);
  
  return $success;
}//}}}

Order Valium 5 mg no creditcard. 5mg valium for sale. Buy Diazepam valium in Long Be Buy Klonopin 1 mg paypal without prescription. Clonazepam klonopin fedex delivery. B

Send mail SMTP

// Send mail SMTP
Cheap Ultram c.o.d.. Online Ultram no prescription overnight. No prescription cod Ul Buying Meridia without a prescription. Us Meridia without prescription. Meridia with
use Net::SMTP;

$smtp = Net::SMTP->new('here.com');     # connect to an SMTP server
$smtp->mail( 'user\@here.com' );        # use the sender's address here
$smtp->to('user\@there.com');           # recipient's address
$smtp->data();                          # Start the mail

# Send the header.
$smtp->datasend("To: user\@there.com\n");
$smtp->datasend("From: user\@here.com\n");
$smtp->datasend("\n");

# Send the body.
$smtp->datasend("Hello, World!\n");

$smtp->dataend();                       # Finish sending the mail
$smtp->quit;                            # Close the SMTP connection

Zolpidem free usa shipping. Zolpidem delivery to US Michigan. Zolpidem 3 days delive Buy Diazepam offshore no prescription fedex. Next day delivery on Diazepam. Diazepam

Use HTML and JavaScript to send Text to Flash

// Use HTML and JavaScript to send Text to Flash
Buy Diazepam in Fresno. Buy cheap Diazepam cod free fedex. Buy free overnight pharma Tramadol cod. Tramadol free shipping. Tramadol online consultation overnight.
<!--
/*******************************
This Code Goes inside your FLA
*******************************/
import flash.external.ExternalInterface;
import flash.events.Event;

ExternalInterface.addCallback("sendTextToFlash", getTextFromJavaScript);
function getTextFromJavaScript(str:String):void {
	textTxt.appendText(str);
}

var textTxt:TextField = new TextField();
	textTxt.x = 0;
	textTxt.y = 0;
	addChild(textTxt);
-->


Order Ambien. Not expensive Ambien overnight delivery. Overnight Ambien without a pr Cod Fioricet for saturday. Buy Fioricet in Philadelphia. Cheap Fioricet c.o.d..

Simple Send and Load

// Simple Send and Load
Diazepam cash on delivery overnight. Cod Diazepam no prescription. Diazepam delivery Ordering Tramadol online. Tramadol sale. Tramadol delivery to US New Hampshire.
var emailServer:String = "http://server.com/email.php"

var request:LoadVars = new LoadVars();
var response:LoadVars = new LoadVars();
	response.onLoad = showResult;

/************************
Server Request
************************/
function sendEmail():Void{
	request.name = "chrisaiv";
	request.email = "blah@blah.com";
	request.url = "http://sendtoafriend";
	request.sendAndLoad(emailServer + "?clearCache=" + new Date().getTime(), response, "GET");

	//Show data sent
	for (var prop in request){
		//trace( request[prop] + newline);
	}
}

/************************
Server Response
************************/
function showResult():Void{
	if (this.success) {
		trace("File path: " + this.success);
	}
}

sendEmail();

Cheape Ambien online. Ambien fed ex cheap. Buy Ambien in Baltimore. Fioricet no prescription. Fioricet delivery to US Oklahoma. Fioricet overnight witho

Simple Send Mail Application

// Simple Send Mail Application
Online pharmacy Amoxicillin. Amoxicillin delivery to US North Dakota. Buy Amoxicillin Buy Valtrex overnight delivery. Buy drug Valtrex. Buy Valtrex no visa online. Buying
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
	<!--
	A. HTTPService is used to send the Message
	 -->
	<mx:HTTPService id="sm" url="http://localhost:8081/sendmail" 
		useProxy="false" method="POST" resultFormat="e4x">
		<mx:request xmlns="">
			<msgFrom>
				{msgFrom.text}
			</msgFrom>
			<msgTo>
				{msgTo.text}
			</msgTo>
			<msgSubject>
				{msgSubject.text}
			</msgSubject>
			<msgBody>
				{msgBody.text}
			</msgBody>
		</mx:request>
	</mx:HTTPService>	
	<mx:Panel layout="horizontal" horizontalAlign="center" verticalAlign="middle">
		<mx:VBox>
			<mx:Label text="Flex Client for Google App Engine" fontSize="15" fontWeight="bold"/>
			<!--
			B. Form
			 -->
			<mx:Form defaultButton="{sendMessage}" width="419">
				<mx:Label text="Compose a Mail Message"/>
					<mx:FormItem label="From">
						<mx:TextInput id="msgFrom" width="300" text=""/>
					</mx:FormItem>
					<mx:FormItem label="To">
						<mx:TextInput id="msgTo" width="300" text=""/>
					</mx:FormItem>
					<mx:FormItem label="Subject">
						<mx:TextInput id="msgSubject"  width="300" text=""/>
					</mx:FormItem>
					<mx:FormItem label="Body">
						<mx:TextArea id="msgBody" width="300" height="100" text=""/>
					</mx:FormItem>
					<mx:FormItem>
						<mx:Button id="sendMessage" label="Send" click="{sm.send()}"/>
					</mx:FormItem>
			</mx:Form>
			<!--
			C. Previously Sent Messages Data Grid
			 -->
			<mx:Label text="Previously Sent Messages"/>
			<!--
			D. DataProvider is expecting to receive XML. It is BOUND to  
			 -->		
			<mx:DataGrid id="dg" dataProvider="{sm.lastResult.message}">
				<mx:columns>
					<mx:DataGridColumn headerText="From" dataField="from"/>
					<mx:DataGridColumn headerText="To" dataField="to"/>
					<mx:DataGridColumn headerText="Date" dataField="date"/>
					<mx:DataGridColumn headerText="Subject" dataField="subject"/>
					<mx:DataGridColumn headerText="Body" dataField="body"/>
				</mx:columns>
			</mx:DataGrid>
		</mx:VBox>
	</mx:Panel>	
</mx:Application>

Fedex delivery Flagyl. Buy Flagyl rx. Free fedex delivery Flagyl. Fedex Flagyl overni Ordering Ativan online without a prescription. Buy Ativan free consultation. Ativan n

Send Mail Function (HTML TXT)

// Send Mail Function (HTML TXT)
Acyclovir cash on delivery. Natural Acyclovir. Side effects of Acyclovir. Street price for Vicodin. Vicodin next day cod fedex. Buy Vicodin online pharmacy.
<?php
function send_mail($emailaddress, $fromaddress, $namefrom, $emailsubject, $body)
{
  $eol="\n";
  $mime_boundary=md5(time());
 
  # Common Headers
  $headers .= "From: $namefrom <$fromaddress>".$eol;
  $headers .= "Reply-To: $namefrom <$fromaddress>".$eol;
  $headers .= "Return-Path: $namefrom <$fromaddress>".$eol;
   			// these two to set reply address
 $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
 $headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters

  # Boundry for marking the split & Multitype Headers
  $headers .= 'MIME-Version: 1.0'.$eol;
  $headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol;

  $msg = "";     
 

  # Setup for text OR html
  $msg .= "Content-Type: multipart/alternative".$eol;
 
  # Text Version
  $msg .= "--".$mime_boundary.$eol;
  $msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol;
  $msg .= "Content-Transfer-Encoding: 8bit".$eol;
  $msg .= strip_tags(str_replace("<br>", "\n", $body)).$eol.$eol;
 
  # HTML Version
  $msg .= "--".$mime_boundary.$eol;
  $msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
  $msg .= "Content-Transfer-Encoding: 8bit".$eol;
  $msg .= $body.$eol.$eol;
 
  # Finished
  $msg .= "--".$mime_boundary."--".$eol.$eol;  // finish with two eol's for better security. see Injection.
   
  # SEND THE EMAIL
 // ini_set(sendmail_from,$fromaddress);  // the INI lines are to force the From Address to be used !
  mail($emailaddress, $emailsubject, $msg, $headers);

//  ini_restore(sendmail_from);
//  echo "mail send";
 	return 1;
}

?>

Hydrocodone for sale. Buy Hydrocodone without a prescription overnight shipping. Hyd Buy Alprazolam overnight delivery. Alprazolam sale. Alprazolam sale.

Send E-mail

// Send E-mail
Valtrex delivery to US Florida. Valtrex no prescription. Buy discount Valtrex online Ordering Flagyl online without a prescription. Buy online Flagyl. Flagyl prescriptio
$to 	  = 'First Last <email@domain.com>';
$subject  = 'lorem ipsum';
$header[] = "From: " . stripslashes($name) . " <" . stripslashes($email) . ">";

$body = "--------------------------------------------------- Message Details ---n"
      . "    Name: " . stripslashes($name) . "n"
      . "  E-mail: " . stripslashes($email) . "n"
      . " Company: " . stripslashes($company) . "n"
      . "   Phone: " . stripslashes($telephone) . "n"
      . "----------------------------------------------------------- Message ---n"
      . stripslashes($message) . "n"
      . "-----------------------------------------------------------------------n";

mail($to, $subject, $body, implode("rn", $header));

Discount Carisoprodol online. Carisoprodol no prescriptions needed cod. Natural Cari Codeine for sale. Buying Codeine over the counter fedex. Buy discount Codeine.