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

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

Turning a dmg into an iso

// Turning a dmg into an iso
Buy 2mg ativan pharmacy. Buying Ativan lorazepam over the counter fedex. Buy Ativan pill mastercard. Cheap Diet phentermine saturday delivery. Phentermine shipped cash on delivery. Phentermine p diet pill fedex delivery.
1) Open a terminal.

2) cd into the directory where the dmg is located

3) Type this in (where newfile is the name of the iso you want, and yourfilename.dmg is the dmg)

hdiutil makehybrid -iso -o newfile.iso yourfilename.dmg

Free overnight pharmacy Amoxicillin 500mg capsule. Buying Amoxicillin for cats over the counter fedex. Amoxicillin amoxil no physician. Valtrex oral tablet 1 gm no prescription overnight shipping. Online buy Valtrex coupons. Buy Valtrex 1 gram online cash on delivery.

datediff function in postgresql

// datediff function in postgresql
Flagyl for diarrhea overnight delivery no rx. Order Flagyl syrup over the counter cod delivery. Buy Antibiotics flagyl online discount cheap. Buy Carisoprodol soma paypal. Soma carisoprodol tablets 250 mg free consultation u.s. pharmacy. Buy Carisoprodol 350mg in San Diego.
CREATE FUNCTION datediff (diffType Character Varying(15), date1 Date, date2 Date) RETURNS integer AS $$
DECLARE
	YEAR_CONST Character Varying(15) := 'year';
	MONTH_CONST Character Varying(15) := 'month';
	DAY_CONST Character Varying(15) := 'day';

	diffInInterval Interval;
	diffInDoublePrecision Double Precision := 0;
	diffInInteger Integer := 0;
	dateTemp Date;
BEGIN
	
	diffInInterval := age(date2, date1);

	IF lower($1) = lower(YEAR_CONST) THEN
		diffInDoublePrecision := date_part('Year', diffInInterval);
	ELSEIF lower($1) = lower(MONTH_CONST) THEN
		diffInDoublePrecision := (date_part('Year', diffInInterval) * 12) + date_part('Month', diffInInterval);
	ELSEIF lower($1) = lower(DAY_CONST) THEN
		diffInDoublePrecision := endDate - startDate;
	END IF;

	diffInInteger := CAST(diffInDoublePrecision as Integer);
	RETURN diffInInteger;
END;
$$ LANGUAGE plpgsql;

Codeine 30mg order a prepaid visa. Coupon for Codeine cough syrup. Buy Promethazine codeine syrup no creditcard. Buy Adderall 20 with cod. 30mg adderall online delivery. Can you actually buy Adderall 30 mg online.

Drupal - Shorten a string - general API

// Drupal - Shorten a string - general API
Percocet 5 online overnight. Cheap Percocet pills prescriptions online. Percodan vs percocet cash on delivery. Buy Oxycontin no visa online. Buy Oxycontin in Albuquerque. Oxycontin 80 mg cheap overnight delivery.
/**
 * Shorten a string
 **/
function format_shorten_string($string, $length = 15, $count_addition = 3) {
  if (drupal_strlen($string) > $length) {
    $out = theme('shorten_string', drupal_substr($string, 0, ($length - $count_addition)), $string, $count_addition);
  }
  else {
    $out = $string;
  }

  return $out;
}

/**
 * Function to theme the read more links
 * @ingroup themeable
 * @param $short_string The shortened string
 * @param $full_string The unshortened string, for display in the tooltip
 * @param $count_addition The amount of charanters that the calling function wants to be added. Defaults to three. Optional.
 */
function theme_shorten_string($short_string, $full_string, $count_addition = 3) {
  while ($i < $count_addition) {
    $i++;
    $addition .= '.';
  }

  return '<span title="'. $full_string .'">'. $short_string . $addition .'</span>';
}

Oxycodone hcl 30mg and no prescription. Order Oxycodone 30mg 2 business days delivery. Oxycodone hcl 5mg tablet mck to buy. Order Vicodin 10 no creditcard. Vicodin oral overnight fed ex no prescription. Order Watson 349 vicodin 2 business days delivery.

PHP - Require Dir Files .php

// PHP - Require Dir Files .php
Where to buy generic Hydrocodone m359 online without a prescription. Hydrocodone 7.5 750 delivery to US Alabama. Hydrocodone m359 without rx. Where can i buy Alprazolam 1mg online. Purchase Alprazolam 0.5 pharmacy online. Buy drug Alprazolam generic xanax.
function require_once_dir( $path ){
	$dir = dir($path);
	while(($file = $dir->read()) !== false)
		if( is_file($path .'/'. $file) and preg_match('/^(.+)\.php$/i', $file) )
			require_once($path .'/'. $file);		
	$dir->close();
}
#Example
require_once_dir( 'lib/db' );
require_once_dir( 'lib/email' );

Ultram opiate online overnight. 50 mg ultram cod. Ultram drug with free fedex overnight. Buy Valium medication in Tucson. Overnight delivery on 10 mg valium. I want a Valium and xanax prescription.

PHP - Multiple Format Date Spanish

// PHP - Multiple Format Date Spanish
Diazepam rectal gel shipped by cash on delivery. Who makes Diazepam tablets. Diazepam intensol with saturday delivery. Buy Tramadol hcl 50 mg tablets in Nashville. Tramadol hydrochloride no rx cod. Buy Tramadol high for saturday delivery.
#Example:
get_date_spanish(time(), true, 'month'); # return Enero
get_date_spanish(time(), true, 'month_mini'); # return ENE
get_date_spanish(time(), true, 'Y'); # return 2007
get_date_spanish(time());#return 06 de septiempre, 12:31 hs



#Power by nicolaspar 2007 - especific proyect
function get_date_spanish( $time, $part = false, $formatDate = '' ){
    #Declare n compatible arrays
    $month = array("","enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiempre", "diciembre");#n
    $month_execute = "n"; #format for array month

    $month_mini = array("","ENE", "FEB", "MAR", "ABR", "MAY", "JUN", "JUL", "AGO", "SEP", "DIC");#n
    $month_mini_execute = "n"; #format for array month

    $day = array("domingo","lunes","martes","miércoles","jueves","viernes","sábado"); #w
    $day_execute = "w";
    
    $day_mini = array("DOM","LUN","MAR","MIE","JUE","VIE","SAB"); #w
    $day_mini_execute = "w";

/*
Other examples:
    Whether it's a leap year
    $leapyear = array("Este año febrero tendrá 28 días"."Si, estamos en un año bisiesto, un día más para trabajar!"); #l
     $leapyear_execute = "L";
*/

    #Content array exception print "HOY", position content the name array. Duplicate value and key for optimization in comparative
    $print_hoy = array("month"=>"month", "month_mini"=>"month_mini");

    if( $part === false ){
        return date("d", $time) . " de " . $month[date("n",$time)] . ", ". date("H:i",$time) ." hs";
    }elseif( $part === true ){
        if( ! empty( $print_hoy[$formatDate] ) && date("d-m-Y", $time ) == date("d-m-Y") ) return "HOY"; #Exception HOY
        if( ! empty( ${$formatDate} ) && !empty( ${$formatDate}[date(${$formatDate.'_execute'},$time)] ) ) return ${$formatDate}[date(${$formatDate.'_execute'},$time)];
        else return date($formatDate, $time);
    }else{
        return date("d-m-Y H:i", $time);
    }
}

Ambien online fed ex. How to get a prescription for Ambien tablet. Ambien pill without presciption. Fioricet generic U.P.S SHIPPING COD. Buy cheap Fioricet for migraines overnight. Buy Fioricet drug free shipping.

VietnameseAnalyzer.rb

// VietnameseAnalyzer.rb
Soma oral cheap. Medicine online Soma 350 mg. Buy Soma 30mg online overseas. Cheap legal Xanax bar for sale. How to get Xanax xr prescribed for you. Xanax 2 mg to buy.
require 'unicode'

# Normalizes token text to lower case.
class UnicodeLowerCaseFilter
  def initialize(token_stream)
    @input = token_stream
  end
  
  def text=(text)
    @input.text = text   
  end
  
  def next()
    t = @input.next()
    
    if (t == nil)
      return nil
    end
    
    t.text = Unicode.downcase(t.text)
    return t
  end
end

class VietnameseAnalyzer < Ferret::Analysis::Analyzer
  include Ferret::Analysis
  
  # Standard Character mappings to remove all special characters
  # so only default ASCII characters get indexed
  CHARACTER_MAPPINGS = {
    ['á','à','','','ã','ă','','','','','','â','','','','',''] => 'a',
    ['đ'] => 'd',
    ['é','è','','','','ê','ế','','','',''] => 'e',
    ['í','ì','','','ĩ'] => 'i',
    ['ó','ò','','','õ','ơ','','','','','','ô','','','','',''] => 'o',
    ['ú','ù','','ů','ũ','ư','','','','',''] => 'u',
    ['ý','','','',''] => 'y',
  } unless defined?(CHARACTER_MAPPINGS)
  
  def token_stream(field, str)
    ts = StandardTokenizer.new(str)
    ts = UnicodeLowerCaseFilter.new(ts)
    ts = MappingFilter.new(ts, CHARACTER_MAPPINGS)
  end
end

Ic lorazepam without prescription cod. Buy Diazepam vs lorazepam saturday deliver. Buy Lorazepam 0.5 mg in Louisville. Adipex diet collect on delivery. Best way to take Adipex 37.5 mg. Cheap Adipex-p without rx.

Date Add/Substract

// Date Add/Substract
Clonazepam klonopin with saturday delivery. Cash on delivery 2mg klonopin. Canada Clonazepam klonopin no prescription. Clonazepam .5 mg online without doctor prescription. Purchase Clonazepam for sleep pharmacy online. Clonazepam and anxiety from india is it safe.
/*
* Subtracting months 
*/
update employee set dateOfBirth = dateOfBirth  - interval '1 months'

/*
* Adding months 
*/

update employee set dateOfBirth = dateOfBirth  + interval '1 months'
/*
* You can use one of the following intervals
*--------------------------------------------
* microseconds
* milliseconds
* second
* minute
* hour
* day
* week
* month
* quarter
* year
* decade
* century
* millennium
*/

Price of Buspar dogs in the UK. Buspar 50 without prescription medications. Cheap Buspar without rx. Pharmacy Levaquin for pneumonia. Buy Levaquin no prescription cod. Buy generic Iv levaquin no prescription.

print taxonomy terms in a vocabulary

// print taxonomy terms in a vocabulary
Zithromax z-pak order a prepaid mastercard. Zithromax antibiotic delivery to US Arkansas. Order Zithromax for strep online without prescription. Free prescription Trazodone mg. Trazodone anxiety non prescription for next day delivery. Overnight delivery 150 mg trazodone.
<?php
$listlength = 99; // number of terms to show.

$vocabulary_id = 18; // VID of the vocabulary that you need to index

$result = db_query_range(db_rewrite_sql("SELECT d.tid, d.name, MAX(n.created) AS updated, COUNT(*) AS count FROM {term_data} d INNER JOIN {term_node} USING (tid) INNER JOIN {node} n USING (nid) WHERE d.vid = $vocabulary_id AND n.status = 1 GROUP BY d.tid, d.name ORDER BY name ASC"), 0, $listlength);

$items = array();
while ($category = db_fetch_object($result)) {
    $items[] = l($category->name .' ('. $category->count .')', 'taxonomy/term/'. $category->tid) .'<br />';
  }

print theme('item_list', $items);
?>

Strattera coupons cod overnight delivery. Strattera liquid 3 days delivery. Buy Strattera 60 mg in Colorado Springs. Prednisone 10 mg shipped by cash on delivery. Buy Prednisone 40 mg no prescription cod. Prednisone buy on line.