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 » template The latest public template snipts.

showing 1-20 of 60 snipts for template
  • Get Template Directory
    <?php bloginfo( 'template_directory' ); ?>
    

    copy | embed

    0 comments - tagged in  posted by skotmxpx on Sep 01, 2010 at 4:46 p.m. EDT
  • html5 template
    <!DOCTYPE html> 
    <html> 
    	<head> 
    		<meta charset="utf-8" /> 
    		<title>untitled</title> 
    	</head> 
    	<body> 
    		
     
    	</body> 
    </html>
    

    copy | embed

    0 comments - tagged in  posted by diskostu on Aug 31, 2010 at 8:44 a.m. EDT
  • minimalistic 'template engine'
    class Template {
      public static function replace($str, $templates) {
        array_walk($templates, array('Template', 'replaceTemplate'), &$str);
        return $str;
      }
    
      private static function replaceTemplate($value, $key, &$str) {
        //echo('<br>replaceTemplate key: '.$key.' value: '.$value.' str: '.$str);
        $str = str_replace('{{'.$key.'}}', $value, $str);
      }
    }
    
    // test:
    echo('<br><br>ret:'.Template::replace(
      <<<TemplateString
    Testtext {{template1}} testtext. {{template1}}
    ; {{template2}}
    TemplateString
      , array('template1' => 'neuer text', 'template2' => 'unused'))
    );
    

    copy | embed

    0 comments - tagged in  posted by OutOfBrain on Jul 25, 2010 at 6:00 p.m. EDT
  • binary search
    #include <iostream>
    
    using namespace std;
    
    template <typename K>
    int bsearch(K temp[], K searchforthis, int low, int high) //recursive search
    {
        int mid;
        mid=low+((high-low)/2); //find middle
        if (temp[mid] > searchforthis) //if middle value is more than what you are searching
            return bsearch(temp, searchforthis, low, mid-1); //then return back to function with middle value -1 as new high
        else if (temp[mid] < searchforthis) //or  if middle value is less than what you are searching
            return bsearch(temp, searchforthis, mid+1, high); //then return back to function with middle value +1 as new low
        else
            return mid;
    }
    
    int main()
    {
        char anarray[]={'Z','F','E','R','G','P','D','A'};
        char term;
        term='D';
        sort(anarray,anarray+(sizeof(anarray)));
        cout<<"Sorted: ";
        for (int i=0;i<8;i++)
            cout<<anarray[i];
        cout<<"\nTerm is found at position "<<bsearch(anarray,term,0,sizeof(anarray))<<endl;
        return 0;
    }
    

    copy | embed

    0 comments - tagged in  posted by wafflesncheese on Jul 18, 2010 at 9:34 a.m. EDT
  • linear search using template
    #include <iostream>
    
    using namespace std;
    
    template <typename K>
    bool search(K temp[], K searchforthis)
    {
        int found=0;
        for (int i=0;i<(sizeof(temp));i++)
            if (temp[i] == searchforthis)
                found=1;
        return found;
    }
    
    int main()
    {
        char anarray[]={'A','C','E','G'};
        char term;
        term='P';
        cout<<"Result = "<<search(anarray,term)<<endl;
        return 0;
    }
    

    copy | embed

    0 comments - tagged in  posted by wafflesncheese on Jul 18, 2010 at 8:52 a.m. EDT
  • HTML5 Table Template
    <table dir="ltr" width="500" border="1" 
    			summary="purpose/structure for speech output">
    	<caption>Here we assign header information to cells 
    			by setting the scope attribute.
    	</caption>
    	<colgroup width="50%" />
    	<colgroup id="colgroup" class="colgroup" align="center" 
    			valign="middle" title="title" width="1*" 
    			span="2" style="background:#ddd;" />
    	<thead>
    		<tr>
    			<th scope="col">Name</th>
    			<th scope="col">Side</th>
    			<th scope="col">Role</th>
    		</tr>
    	</thead>
    	<tfoot>
    		<tr>
    			<td>Darth Vader</td>
    			<td>Dark</td>
    			<td>Sith</td>
    		</tr>
    	</tfoot>
    	<tbody>
    		<tr>
    			<td>Obi Wan Kenobi</td>
    			<td>Light</td>
    			<td>Jedi</td>
    		</tr>
    		<tr>
    			<td>Greedo</td>
    			<td>South</td>
    			<td>Scumbag</td>
    		</tr>
    	</tbody>
    </table>
    

    copy | embed

    0 comments - tagged in  posted by salxo on Jul 05, 2010 at 9:59 a.m. EDT
  • JSP & HTML5 template
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    xmlns:c="http://java.sun.com/jsp/jstl/core"
    xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
    xmlns="http://www.w3.org/1999/xhtml"
    version="2.0">
    <jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>
    
    <![CDATA[<!DOCTYPE html>]]>
    <html lang="de">
        <head>
            <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
            <title>Neopay Init-Antwort</title>
            <link rel="stylesheet" type="text/css" href="http://www.blueprintcss.org/blueprint/src/typography.css"/>
            <link rel="stylesheet" type="text/css" href="http://www.blueprintcss.org/blueprint/src/forms.css"/>
            <link rel="stylesheet" type="text/css" href="http://www.blueprintcss.org/blueprint/src/grid.css"/>
        </head>
    
        <body>
            <div class="container">
    
            </div>
    
        </body>
    </html>
    
    </jsp:root>
    

    copy | embed

    0 comments - tagged in  posted by lenni on May 31, 2010 at 10:45 a.m. EDT
  • Class template example
    #include <iostream>
    using namespace std;
    /* put in the class template codes here */\
    template<class>  //template <typename> is also ok
    class Item
    {
        public:
          Item(T xItem);     // constructor, element is type T, generic
          void showItem();   // member function
        private:
           T anItem;        //T can be replaced by any data type
    };
    
    template <class>      //start of the implementation
    Item<t>::Item(T xItem)   //the constructor
    {
        Item::anItem = xItem;  /* sets Item's data member to the value                            of xItem which is passed to the                             construction */
    }
    template <class>
    void Item<t>::showItem()
    {
        cout << "The value stored in anItem is:"  << Item::anItem <<endl;
    }
    
    int main()
    {
        Item<int> intItem(100);
        intItem.showItem( );
        Item<double> dblItem(38.3);
        dblItem.showItem();
    
        return 0;
    }
    

    copy | embed

    0 comments - tagged in  posted by p0920472 on May 29, 2010 at 3:21 a.m. EDT
  • template
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    template <typename T>
    T calarea(T length , T width, T *area)
    {
        *area = width * length;
        cout << "Area is : " << *area << endl;
        return *area;
    }
    template <typename T>
    void calvol(T height, T *area)
    {
        cout << "Volume is : " << (*area * height) << endl;
    }
    
    int main()
    {
        int length = 5, width = 5, height = 5, area;
        double dlength = 5.5, dwidth = 5.5, dheight = 5.5, darea;
        float flength = 5.5555, fwidth = 5.5555, fheight = 5.5555, farea;
        area=calarea(length,width,&area);
        calvol(height, &area);
        darea=calarea(dlength,dwidth,&darea);
        calvol(dheight, &darea);
        farea=calarea(flength,fwidth,&farea);
        calvol(fheight, &farea);
        return 0;
    }
    

    copy | embed

    0 comments - tagged in  posted by Hector_Tian on May 11, 2010 at 12:26 p.m. EDT
  • template
    #include <iostream>
    
    using namespace std;
    
    template <typename K>
    void calcArea(K length, K width)
    {
        K Area;
        Area=length * width;
        cout<<"Area is: "<<Area<<endl;
    }
    
    int main()
    {
        int ilength=5, iheight=6, iwidth=7;
        double dlength=5.5, dheight=6.6, dwidth=7.7;
        float flength=5.123456, fheight=6.123456, fwidth=7.123456;
        calcArea(ilength, iwidth);
        calcArea(dlength, dwidth);
        calcArea(flength, fwidth);
        return 0;
    }
    

    copy | embed

    0 comments - tagged in  posted by wafflesncheese on May 11, 2010 at 12:12 a.m. EDT
  • JSP Page template
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
    					xmlns:c="http://java.sun.com/jsp/jstl/core"
    					xmlns:fmt="http://java.sun.com/jsp/jstl/fmt"
    					xmlns:jb="http://www.mytoys.de/jbacca"
    					xmlns="http://www.w3.org/1999/xhtml"
    					version="2.0">
    	<jsp:directive.page contentType="text/html" pageEncoding="UTF-8"/>
    
    	<script text="text/javascript">
    		window.open('schritt1.jsp','mywin',
    		'left=20,top=20,width=500,height=500,toolbar=1,resizable=0');
    	</script>
    
    </jsp:root>
    

    copy | embed

    0 comments - tagged in  posted by lenni on May 07, 2010 at 6:20 a.m. EDT
  • AS3 Interface Class
    package
    {
    	public interface IMyInterface
    	{
    		
    	}
    }
    

    copy | embed

    0 comments - tagged in  posted by corbanb on Apr 30, 2010 at 9:08 a.m. EDT
  • AS3 Class File
    package
    {
    	import flash.display.MovieClip;
    
    	public class MyClass extends MovieClip
    	{
    		public function MyClass()
    		{
    		}
    	}
    }
    

    copy | embed

    0 comments - tagged in  posted by corbanb on Apr 30, 2010 at 8:59 a.m. EDT
  • jquery simple plugin starter template so you dont have to type it over and over and over and over and ov....
    (function($){
    	// relace "xxxx" with plugin name
    	$.fn.xxxx = function(options) {
    	
    		// default options list
    		var defaults = {
    			// defaults go here
    		}
    		
    		//extend options
    		var options = $.extend(defaults, options);
    		
    		//start plugin
    		return this.each(function() {
    			//code goes here
    		
    		});
    		
    	});
    }(jQuery)
    

    copy | embed

    0 comments - tagged in  posted by retardikas on Apr 07, 2010 at 3:03 p.m. EDT
  • Resharper mock declaration
    /// <summary>
    /// The mock I$arg$ object.
    /// </summary>
    private I$arg$ _mock$arg$;
    

    copy | embed

    0 comments - tagged in  posted by fk122 on Mar 24, 2010 at 12:18 p.m. EDT
  • Resharper argument out of range exception
    if ($arg$ < 1)
    	throw new ArgumentOutOfRangeException("$arg$");
    

    copy | embed

    0 comments - tagged in  posted by fk122 on Mar 24, 2010 at 12:17 p.m. EDT
  • Resharper string argument null
    if (string.IsNullOrEmpty($arg$))
    	throw new ArgumentNullException("$arg$");
    

    copy | embed

    0 comments - tagged in  posted by fk122 on Mar 24, 2010 at 12:16 p.m. EDT
  • Resharper argument null template
    if ($arg$ == null)
    	throw new ArgumentNullException("$arg$");
    

    copy | embed

    0 comments - tagged in  posted by fk122 on Mar 24, 2010 at 12:16 p.m. EDT
  • HTML5 boilerplate
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=utf-8 />
    <title>HTML 5 complete</title>
    <!--[if IE]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <style>
      article, aside, dialog, figure, footer, header,
      hgroup, menu, nav, section { display: block; }
    </style>
    </head>
    <body>
    <p>Hello World</p>
    </body>
    </html>
    

    copy | embed

    0 comments - tagged in  posted by janbech on Feb 24, 2010 at 2:14 a.m. EST
  • jquery plugin template
    ;(function($) {
    	$.fn.pluginName = function(settings) {
    		var o = $.extend({}, $.fn.pluginName.defaults, settings);
    
    		return this.each(function() {
    			var element = $(this);
    			//	Stick your functionality here, yo..
    		})
    	}
    
    	$.fn.pluginName.defaults = {}
    })(jQuery);
    

    copy | embed

    0 comments - tagged in  posted by frontendcoder on Feb 10, 2010 at 4:40 p.m. EST
Sign up to create your own snipts, or login.