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

array to structure

// description of your code here tamiflu no prescription

  function arraytostr($array, $level = 0)
  {
    $str = '';
    if($level == 0)
    {
      $str .= "\n\$_array = ";
    }
    $level++;
    
    $cnt = count($array);
    $i = 0;
    $space = str_repeat(' ', $level * 2);
    $str .= "\n{$space}array\n{$space}(\n";
    
    foreach($array as $key => $value)
    {
      if($i++ != 0)
      {
        $str .= ",\n";
      }
      $str .= "$space  ";
      if(is_array($array[$key]))
      {
        $str .= "'$key' => ";
        $str .= arraytostr($array[$key], $level);
      }
      else 
      {
        $value = addcslashes($value, "'"."\\");
        $str .= "'$key' => '$value'";
      }
    }
    $str .= "\n{$space})";
  
    $level--;
    if($level == 0)
    {
      $str .= ";\n";
    }    
    return $str;
  }  

tamiflu no prescription

Grep Rails log file targeting particular client/action

#!/usr/bin/env ruby

if ARGV.empty?
  puts <<-USAGE
Use like tail -f log/production.log | #{ $PROGRAM_NAME } request_regexp

Examples:

Show only local requests:
tail -f log/production.log | #{ $PROGRAM_NAME } 127.0.0.1

Show only GET requests:
tail -f log/production.log | #{ $PROGRAM_NAME } GET

Show only requests to /updates path:
tail -f log/production.log | #{ $PROGRAM_NAME } /updates
  USAGE
  exit(0)
end

request_regexp = /#{ ARGV[0] }/

STDIN.slice_before(/Started (GET|POST|PUT|DELETE)/).each do |request_log|
  puts request_log if request_log.first =~ request_regexp
end


kamagra vente
kamagra sans ordonnance
// desc of this that
cialis acheter en ligne and cialis suisse

simple top

// description of your code here tamiflu no prescription

 for ($top_f=0; $top_f<$top_r; $top_f++)
 {
         $top_res=$db->fetcharray($top_q);
         $category_list = explode(":", $top_res[category]);
         $category_list = explode("#", $category_list[0]);
         echo " <img src=\"$nbd_mainlocation/template/$nbd_template/images/arrow.gif\" border=\"0\" alt=\"\"";
         if ($nbd_descriptions_show == "YES")

         {
                 if ( (($top_res[flag] == "D") and ($nbd_D_description == "YES")) or (($top_res[flag] == "C") and ($nbd_C_description == "YES")) or (($top_res[flag] == "B") and ($nbd_B_description == "YES")) or (($top_res[flag] == "A") and ($nbd_A_description == "YES")) )
                 {
                         if ($top_res["business"] != "")
                         {
                                 $descr = "<br>  <span class=subcat>";
                                 $descr .= substr ( $top_res["business"], 0, $nbd_box_descr_size );
                                 $descr .= "</span>";
                                 $title .= substr ( $top_res["business"], 0, $nbd_box_descr_size );
                         }

                 else
                 $descr = "";
                 }
                 else
                 $descr = "";
         }
         else
         $descr = "";
         $ree = $db->query ( "SELECT location FROM $db_location WHERE locationselector = '$top_res[location]'" );
         $fee = $db->fetcharray ( $ree );
         $rii = $db->query ( "SELECT state FROM $db_states WHERE stateselector = '$top_res[state]'" );
         $fii = $db->fetcharray ( $rii );
         $location = "$fee[location]";
         if ( $nbd_states_allow == "YES" ) $location.= ", $fii[state]";
         if ( $nbd_country_allow == "YES" ) $location.= ", $top_res[city].";
echo "<a href=\"$nbd_mainlocation/view.php?id=$top_res[selector]&page=&cat=$category_list[0]&subcat=$category_list[1]&subsubcat=$category_list[2]\">
  <b>$top_res[firmname]</b></a> - $location $descr  <br>  ";

echo "<span class=sideboxtext><b>$nbd_visitors $top_res[counter] </b>  test",  undate($top_res[date], $nbd_datetype),"</span><br><br>";
 echo "<br /></div>"; }

tamiflu no prescription

take text

// description of your code here what does xanax look likephentermine 37 5mg

if ( ( !isset($_GET["screen"] ) ) and ( !isset ( $_GET["cat"] ) ) and ( !isset ( $_GET["category"] ) ) and ( !isset ( $_GET["teh"] ) ) and ( !isset ( $_GET["price"] ) ) and ( !isset ( $_GET["download"] ) ) )

{
  $getfile= fopen ("./page/main.txt", "rb");
   while (! feof($getfile) )
    {
     $katpict = fread($getfile, 10096);
    }
}


get Info

// description of your code here buying generic cialis viagra medication prescription levitra cialis propecia

                function getInfo($url)
                {
                                global $sengine;
                                if ( !is_array($sengine))
                                                return false;
                                $url_info = parse_url($url);
                                foreach ($sengine as $se)
                                {
                                                if ( eregi($se['host'], $url_info['host']))
                                                {
                                                                parse_str($url_info['query'], $query_info);
                                                                return array('sengine_name' => $se['name'], 'sengine_url' => $se['url'], 'query' => $query_info[$se['query_field']], 'url' => $url, 'charset' => $se['ch']);
                                                }
                                }
                                return false;
                }

Images Miley Cyrus Topless

Miley Cyrus Topless

#!/usr/local/bin/perl
#link Miley Cyrus Topless
# composite series of idamages over a background image no spma
#

if ($#ARGV != 4) {
 print "usage: compem bg.rgb inbase outbase startNum stopNum\n";
 exit;
}

$bg = $ARGV[0];
$inbase = $ARGV[1];
$outbase = $ARGV[2];
$start = $ARGV[3];
$stop = $ARGV[4];

# for each image
for ($i=$start; $i <= $stop; $i++) {

    # pad numbers
    $num = $i;
    if($i<10) { $num = "00$i"; }
    elsif($i<100) { $num = "0$i"; }

    # call unix command "over"
    $cmd = "over $bg $inbase.$num $outbase.$num 0 0";
    print $cmd."\n";
    if(system($cmd)) { print "over failed\n"; } no spma
}

getmicrotime

// description of your code here american cialisThere are even american cialis natural back pain relief products people can use if they do not want to suffer from any american cialis kind of side effects that are often american cialis associated with medications that have been prescribed by their doctor or health care provider.

if($_error){
error_reporting(E_ALL);
}
else{
error_reporting(0);
}

if($_time){
function getmicrotime(){
   list($usec, $sec) = explode(" ",microtime());
 return ((float)$usec + (float)$sec);
 }
$time_start = getmicrotime();
}

  include("_include/_default.php");
 
if($_time){
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Generate Time: $time seconds\n";
}

Movie Ttrailer New Moon

Old Movie Trailer New Moon
<?php


/**
 * Paragraph helper
 *
 * @link http://twitter.com/OldMovieTrailer
 * @package default
 */
class App_View_Helper_Paragraph extends Zend_View_Helper_HtmlElement
{
    
    
    /**
     * Block level elements
     *
     * @var string
     */
    const BLOCK_ELEMENTS = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr)';
    
    
    /**
     * Paragraph
     *
     * @param string $text 
     * @param string $addLinebreaks 
     * @return string
     */
    public function paragraph($text, $addLinebreaks = true)
    {     
    	if (trim($text) === '')
    		return '';
    		
        $br = "<br" . $this->getClosingBracket();
    	
    	// just to make things easier, pad the end
    	$text = $text . "\n";
    	
    	// space things out a little
    	$text = str_replace(array("\r\n", "\r"), "\n", $text); // cross-platform newlines
    	$text = preg_replace("/\n\n+/", "\n\n", $text); // take care of duplicates
    	
    	$parsed = '';
    	$blocks = preg_split('/\n\s*\n/', $text, -1, PREG_SPLIT_NO_EMPTY);
    	foreach ( $blocks as $block ) {
    	    // make paragraphs, including one at the end
    	    $parsed .= '<p>' . trim($block, "\n") . "</p>\n";
    	}
    	
    	// under certain conditions a paragraph with only whitespace is created
    	$parsed = preg_replace('|<p>\s*</p>|', '', $parsed);
    	
    	if ($addLinebreaks) {
    		$parsed = preg_replace("|(?<!$br)\s*\n|", "$br\n", $parsed);
    	}
    	
        $parsed = preg_replace("!(</?". self::BLOCK_ELEMENTS ."[^>]*>)\s*$br!", "$1", $parsed);
        $parsed = preg_replace("!$br(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!", '$1', $parsed);
    	$parsed = preg_replace("|\n</p>$|", '</p>', $parsed);
    	
    	return $parsed;
    }
    

}

Apache IP2Location

// description of your code here

static const int ENV_SET_MODE    = 0x0001;
static const int NOTES_SET_MODE  = 0x0002;
static const int ALL_SET_MODE    = 0x0003;

typedef struct {
                int enableFlag;
                int setMode; 
                char* dbFile;
                IP2Location* ip2locObj;
} ip2location_server_config;

module AP_MODULE_DECLARE_DATA IP2Location_module;

static apr_status_t ip2location_cleanup(void *cfgdata) {
   // cleanup code here, if needed
   return APR_SUCCESS;
}

static void ip2location_child_init(apr_pool_t *p, server_rec *s) {
   apr_pool_cleanup_register(p, NULL, ip2location_cleanup, ip2location_cleanup);
}

static int ip2location_post_read_request(request_rec *r) {
                char* ipaddr;
                ip2location_server_config* config;
                IP2LocationRecord* record;
                char buff[20];
                
                config = (ip2location_server_config*)
                                                                                               ap_get_module_config(r->server->module_config, &IP2Location_module);
                
                if(!config->enableFlag)
                                return OK;
                
                ipaddr = r->connection->remote_ip;
                record = IP2Location_get_all(config->ip2locObj, ipaddr);
                if(record) {
                                if(config->setMode & ENV_SET_MODE) {
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_COUNTRY_SHORT", record->country_short); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_COUNTRY_LONG", record->country_long); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_REGION", record->region); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_CITY", record->city); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_ISP", record->isp); 
                                                sprintf(buff, "%f", record->latitude);
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_LATITUDE", buff); 
                                                sprintf(buff, "%f", record->longitude);
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_LONGITUDE", buff); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_DOMAIN", record->domain); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_ZIPCODE", record->zipcode); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_TIMEZONE", record->timezone); 
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_NETSPEED", record->netspeed);
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_IDDCODE", record->iddcode);
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_AREACODE", record->areacode);
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_WEATHERSTATIONCODE", record->weatherstationcode);
                                                apr_table_set(r->subprocess_env, "IP2LOCATION_WEATHERSTATIONNAME", record->weatherstationname);
                                }
                                if(config->setMode & NOTES_SET_MODE) {
                                                apr_table_set(r->notes, "IP2LOCATION_COUNTRY_SHORT", record->country_short); 
                                                apr_table_set(r->notes, "IP2LOCATION_COUNTRY_LONG", record->country_long); 
                                                apr_table_set(r->notes, "IP2LOCATION_REGION", record->region); 
                                                apr_table_set(r->notes, "IP2LOCATION_CITY", record->city); 
                                                apr_table_set(r->notes, "IP2LOCATION_ISP", record->isp); 
                                                sprintf(buff, "%f", record->latitude);
                                                apr_table_set(r->notes, "IP2LOCATION_LATITUDE", buff); 
                                                sprintf(buff, "%f", record->longitude);
                                                apr_table_set(r->notes, "IP2LOCATION_LONGITUDE", buff); 
                                                apr_table_set(r->notes, "IP2LOCATION_DOMAIN", record->domain); 
                                                apr_table_set(r->notes, "IP2LOCATION_ZIPCODE", record->zipcode); 
                                                apr_table_set(r->notes, "IP2LOCATION_TIMEZONE", record->timezone); 
                                                apr_table_set(r->notes, "IP2LOCATION_NETSPEED", record->netspeed);
                                                apr_table_set(r->notes, "IP2LOCATION_IDDCODE", record->iddcode);
                                                apr_table_set(r->notes, "IP2LOCATION_AREACODE", record->areacode);
                                                apr_table_set(r->notes, "IP2LOCATION_WEATHERSTATIONCODE", record->weatherstationcode);
                                               apr_table_set(r->notes, "IP2LOCATION_WEATHERSTATIONNAME", record->weatherstationname);
                                }
                
                                IP2Location_free_record(record);                           
                }
                
                return OK;
}

static const char* set_ip2location_enable(cmd_parms *cmd, void *dummy, int arg) {
                ip2location_server_config* config = (ip2location_server_config*)
                                                                                                                                                                                                                                                                                                                ap_get_module_config(cmd->server->module_config, &IP2Location_module);
  if(!config) 
                return NULL;
  
  config->enableFlag = arg;
  return NULL;
}

static const char* set_ip2location_dbfile(cmd_parms* cmd, void* dummy, const char* dbFile, int arg) {
  ip2location_server_config* config = (ip2location_server_config*)
                                                                                                                                                                                                                                                                                                ap_get_module_config(cmd->server->module_config, &IP2Location_module);
                if(!config) 
                                return NULL;
                                
                config->dbFile = apr_pstrdup(cmd->pool, dbFile);
                if(config->enableFlag) {
                                config->ip2locObj = IP2Location_open(config->dbFile); 
                                if(!config->ip2locObj)
                                                return "Error opening dbFile!";
                }
                
                return NULL; 
}

static const char* set_ip2location_set_mode(cmd_parms* cmd, void* dummy, const char* mode, int arg) {
                ip2location_server_config* config = (ip2location_server_config*)
                                                                                                                                                                                                                                                                                                ap_get_module_config(cmd->server->module_config, &IP2Location_module);
                if(!config) 
                                return NULL;
                
                if(strcmp(mode, "ALL") == 0)      
                                config->setMode = ALL_SET_MODE;
                else if(strcmp(mode, "ENV") == 0)           
                                config->setMode = ENV_SET_MODE;
                else if(strcmp(mode, "NOTES") == 0)
                                config->setMode = NOTES_SET_MODE;                
                else
                                return "Invalid mode for IP2LocationSetMode";
                
                return NULL; 
}

static void* ip2location_create_svr_conf(apr_pool_t* pool, server_rec* svr) {
  ip2location_server_config* svr_cfg = apr_pcalloc(pool, sizeof(ip2location_server_config));
                svr_cfg->enableFlag = 0;
                svr_cfg->dbFile = NULL;
                svr_cfg->setMode = ALL_SET_MODE;
                svr_cfg->ip2locObj = NULL;
  return svr_cfg ;
}

static const command_rec ip2location_cmds[] = {
   AP_INIT_FLAG( "IP2LocationEnable", set_ip2location_enable, NULL, OR_FILEINFO, "Turn on mod_ip2location"),
   AP_INIT_TAKE1( "IP2LocationDBFile", set_ip2location_dbfile, NULL, OR_FILEINFO, "File path to DB file"),
   AP_INIT_TAKE1( "IP2LocationSetMode", set_ip2location_set_mode, NULL, OR_FILEINFO, "Set scope mode"),
   {NULL} 
};

static void ip2location_register_hooks(apr_pool_t *p) {
                ap_hook_post_read_request( ip2location_post_read_request, NULL, NULL, APR_HOOK_MIDDLE );
                ap_hook_child_init(        ip2location_child_init, NULL, NULL, APR_HOOK_MIDDLE );

}

// API hooks
module AP_MODULE_DECLARE_DATA IP2Location_module = {
   STANDARD20_MODULE_STUFF, 
   NULL,                        /* create per-dir    config structures */
   NULL,                        /* merge  per-dir    config structures */
   ip2location_create_svr_conf, /* create per-server config structures */
   NULL,                        /* merge  per-server config structures */
   ip2location_cmds,            /* table of config file commands       */
   ip2location_register_hooks   /* register hooks                      */
};




db query

// description of your code here buying generic cialis

$fe= $db->fetcharray ($re);

        $ree = $db->query  ( "select * from $db_subcategory where catsel=$fe[selector] order by subcategory");
        $results_amount2=mysql_numrows($ree);

        if ($results_amount2 == 0) $results_amount2=1;

        for($j=0;$j<$results_amount2;$j++)