IMPORTANT!

Snipt is going open source. We've toyed with this idea for quite a while, and have finally decided it's the right way to move forward.

A few things:
  • The entire Snipt source code will be released on GitHub under the 3-clause BSD License on Friday, September 10th.
  • While we'd like to think we're perfect, we realize we're only human. By open sourcing the software that runs this website, certain bugs or security flaws may be discovered that could compromise the privacy of your snipts.
  • Only the Lion Burger team will be able to push commits to the Snipt.net site. Contributors should send a pull request to add new features or submit patches.
  • By using this site, you agree not to be too angry or take any legal action against Lion Burger should this whole thing go up in flames some day.
  • Follow us on Twitter for updates.
I agree, close this message
Sign up to create your own snipts, or login.

Latest 100 public snipts » aidilfbk's snipts The latest snipts from aidilfbk.

showing 1-2 of 2 snipts
  • PNG transparent 1x1px generator
    <?php
    /*****************************************************************
     * Script for automatic generation of one pixel
     * alpha-transparent images for non-RGBA browsers.
     * @author Lea Verou
     * @version 1.0 beta
     * Licensed under a MIT license
     *****************************************************************/
    
    ######## SETTINGS ##############################################################
    
    /**
     * Enter the directory in which to store cached color images.
     * This should be relative and SHOULD contain a trailing slash.
     * The directory you specify should exist and be writeable (CHMOD 666 or 777).
     * If you want to store the pngs at the same directory, leave blank ('').
     */
    define('COLORDIR', 'rgba/');
    
    
    /**
     * If you requently use a color with varying alphas, you can name it
     * below, to save you some typing and make your CSS easier to read.
     */
    $color_names = array(
    	'white' => array(255,255,255),
    	'black' => array(0,0,0)
    	// , 'mycolor' => array(red value, green value, blue value)
    );
    
    
    /**
     * If you don't want the generated pngs to be stored in the server, set the following to
     * false. This is STRONGLY NOT RECOMMENDED. It's here only for testing/debugging purposes.
     */
    define('CACHEPNGS', true);
    
    
    
    ######## NO FURTHER EDITING, UNLESS YOU REALLY KNOW WHAT YOU'RE DOING ##########
    
    $dir = substr(COLORDIR,0,strlen(COLORDIR)-1);
    if(!is_writable($dir))
    {
    	die("The directory '$dir' either doesn't exist or isn't writable.");
    }
    
    $rgb = $color_names[$_GET['name']];
    
    $red	= is_array($rgb)? $rgb[0] : intval($_GET['r']);
    $green	= is_array($rgb)? $rgb[1] : intval($_GET['g']);
    $blue	= is_array($rgb)? $rgb[2] : intval($_GET['b']);
    $alphaurl = $_GET['a'];
    
    // "A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent."
    // http://www.php.net/manual/en/function.imagecolorallocatealpha.php
    $alpha = intval(127 - 127 * ($alphaurl / 100));
    
    // Does it already exist?
    $filepath = COLORDIR . "r{$red}_g{$green}_b{$blue}_a{$alphaurl}.png";
    
    if(/*CACHEPNGS and */file_exists($filepath))
    {
    $url = "http://{$_SERVER['HTTP_HOST']}/{$filepath}";
    header("Status: 301");
    die(header("Location: {$url}"));
    }
    else
    {
    	// Send headers
    header('Content-Type: image/png');
    header("Expires: ".gmdate("D, d M Y H:i:s", strtotime('+5 years'))." GMT"); 
    
    
    	$img = @imagecreatetruecolor(1,1) or die('Cannot Initialize new GD image stream');
    	
    	// This is to allow the final image to have actual transparency
    	// http://www.php.net/manual/en/function.imagesavealpha.php
    	imagealphablending($img, false);
    	imagesavealpha($img, true);
    	
    	// Allocate our requested color
    	$color = imagecolorallocatealpha($img, $red, $green, $blue, $alpha);
    	
    	// Fill the image with it
    	imagefill($img,0,0,$color);
    
        // Save the file
    	imagepng($img,$filepath,0,NULL);
    	
    	// Serve the file
    	imagepng($img);
    	flush();
    	
    	// Free up memory
    	imagedestroy($img);
    }
    ?>
    

    copy | embed

    0 comments - tagged in  posted by aidilfbk on May 25, 2009 at 7:49 a.m. EDT
  • habbo maintenance page
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>Habbo</title>
    
    <link href="/static/style.css" type="text/css" rel="stylesheet" />
    
    <!--[if IE]>
    <link href="/static/ie-all.css" type="text/css" rel="stylesheet" />
    <![endif]-->
    <!--[if lt IE 7]>
    <link href="/static/ie6.css" type="text/css" rel="stylesheet" />
    <![endif]-->
    
    <script language="JavaScript" type="text/javascript" src="http://images.habbohotel.co.uk/web/web-2.1.0_b9/js/habbo.js"></script>
    
    </head>
    <body>
    
    <div id="page-container">
    	<div id="header-container">
    	</div>
    	<div id="maintenance-container">
    		<div id="content-container">
    			<div id="inner-container">
    
    			<div id="left_col">
    
    			<!-- bubble -->
    			<div class="bubble">
    				<div class="bubble-body">
    					<img src="/static/alert_triangle.gif" width="30" height="29" alt="" border="0" align="left" class="triangle" />
    					<b>Oh no Smithy! Habbo has vanished!</b>
    					<div class="clear"></div>
    				</div>
    			</div>
    			<div class="bubble-bottom">
    				<div class="bubble-bottom-body">
    					<img src="/static/bubble_tail_left.gif" alt="" width="22" height="31" />
    				</div>
    			</div>
    			<!-- \bubble -->
    
    			<img src="/static/frank_habbo_down.gif" width="57" height="87" alt="" border="0" />
    
    			</div>
    
    			<div id="right_col">
    
    			<!-- bubble -->
    			<div class="bubble">
    				<div class="bubble-body">
    					Oh, calm down Frank. We're just in the process of fixing something in Habbo had to take the website down while we work. We're hoping to return shortly so why not grab a slice of cherry pie and come back soon?
    					<div class="clear"></div>
    				</div>
    			</div>
    			<div class="bubble-bottom">
    				<div class="bubble-bottom-body">
    					<img src="/static/bubble_tail_left.gif" alt="" width="22" height="31" />
    				</div>
    			</div>
    			<!-- \bubble -->
    
    			<img src="/static/workman_habbo_down.gif" width="125" height="118" alt="" border="0" />
    
    			</div>
    
    			</div>
    		</div>
    	</div>
    	<div id="footer-container"></div>
    </div>
    
    <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    _uacct = "UA-448325-22";
    urchinTracker('/error500');
    </script>
    
    </body>
    </html>
    

    copy | embed

    0 comments - tagged in  posted by aidilfbk on May 19, 2009 at 2:08 a.m. EDT
Sign up to create your own snipts, or login.