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

Remove images from html

// Remove images from html
Watson Periactin for dogs fedex. Overnight Periactin anxiety. Periactin otc delivery Buy Propecia no doctor. Online pharmacy Propecia for hair loss cod. Propecia 1mg del
<?php

function get_images($file,$url){
$regs=array();
$images=array();
preg_match_all('/<\s?img(.*?)>/i',$file,$regs);
foreach($regs[0] as $key=>$value){
$items = explode('=',$value);
$count = count($items);
for($i=0;$i<$count;$i++){
$item = str_replace(strrchr($items[$i+1],' '),'',$items[$i+1]);
$item = trim(preg_replace('/("|\')/','',$item));
if(preg_match('/src/i',$items[$i])){
if(trim($item)!=''){
if(preg_match('/((.*)(\.gif|\.jpeg|\.jpg|\.png))(.*)/',$item,$reg)){
$images[$key]['src']=find_true_path($url,$reg[1]);
}
}else{
continue;
}
}
elseif(preg_match('/alt/i',$items[$i])){
if($item!=''){
if(isset($images[$key]['src'])){
$images[$key]['alt']=$item;
}else{
continue;
}
}else{
continue;
}
}
elseif(preg_match('/title/i',$items[$i])){
if($item!=''){
if(isset($images[$key]['src'])){
$images[$key]['title']=preg_replace('/[\"\']/','',$item);
}else{
continue;
}
}else{
continue;
}
}else{
continue;
}
}
}
return($images);
}

function find_true_path($url,$image_location){
if(preg_match('/http/',$image_location)){
return($image_location);
}else{
$true_location='';

if(substr($image_location,0,2)=='./'){
$image_location=substr($image_location,2);
}
elseif(substr($image_location,0,1)=='/'){
$image_location=substr($image_location,1);
}else{
$image_location=$image_location;
}
$back_folder_count = substr_count($image_location,'../');
$url = substr($url,0,strrpos($url,'/'));
for($i=0;$i<$back_folder_count;$i++){
if(strrpos($url,'/')==strlen($url)-1){
$url = substr($url,0,-1);
$url = substr($url,0,strrpos($url,'/'));
}else{
$url = substr($url,0,strrpos($url,'/'));
}
}
if(substr($url,-1)!='/'){
$url = $url.'/';
}
$image_location = preg_replace('/(\.\.\/)/','',$image_location);
$true_location = $url.$image_location;
return($true_location);
}
}
?>

Kamagra quick overnight delivery no rx. Next day delivery Kamagra quick with no scri Synthroid 50 mcg delivery to US Minnesota. Synthroid 200mcg without a prescription o

svnremove.groovy Remove all svn removed files from working dir

// svnremove.groovy Remove all svn removed files from working dir
Buy cheap Soma without prescription. Soma without prescription cheap. Soma without a Xanax no dr. Buy Xanax prescriptions. Xanax DHL shipping.
#!/usr/bin/env groovy

// Remove all svn removed files from working dir
def wd = args.size()>0 ? args[0] : '.'
def svnStatusCmd = "svn st $wd"
def svnRemoveCmd = "svn rm "

svnStatusCmd.execute().text.split("\n").each{ line ->
        matcher = (line =~ /^\!\s+(.+)$/)
        if(matcher.find()){
                def file = matcher.group(1)
                def cmd = svnRemoveCmd + " " + file
                print cmd.execute().text
        }
}

Lorazepam no prescription worldwide. Cheap Lorazepam. Lorazepam cod. Purchase Adipex online. Adipex online Cash on Delivery. Buy cheap cod online Adipex.

Remove IE7 activex borders

// Remove IE7 activex borders
Ultram purchased online without prescription. Canadian prescriptions Ultram. Ultram Valium cheap. Valium buy on line. Valium delivery to US Oklahoma.
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
    theObjects.outerHTML = theObjects.outerHTML;
}

Viagra 1 business day delivery. Viagra delivery to US North Dakota. Viagra no script Zolpidem delivery to US Oklahoma. Zolpidem cash on delivery. Zolpidem without prescr

Workaround to remove or rename files with long names

// Workaround to remove or rename files with long names
Order Discount lunesta online without prescription. Lunesta mg 2 business days delivery. Lunesta for sleep online no perscription. Snorting Natural adderall. Buy Concerta adderall no visa. Natural adderall shipped with no prescription.
REM map a temporary directory to the current path

subst T: .
T:

REM rename the file
rename "a-very-long-(over-200-characters-here)-name.doc" shortname.doc

REM or remove it 
del "a-very-long-(over-200-characters-here)-name.doc"

REM then detach the temp. drive
C:
subst T: /d

Amoxicillin for cats online no prescription. Cheap fedex Amoxicillin without rx. Discount Amoxicillin antibiotic. Buy Ambien pill paypal. Cheap fedex Ambien 10mg without rx. Cheap Ambien next day.

Recursively Remove All .svn Directories

// Remove all of the hidden .svn directories on a linux machine

$ find . -name .svn -print0 | xargs -0 rm -rf