Latest 100 public
snipts » template
showing 1-20 of 60 snipts for template
-
∞ Get Template Directory
<?php bloginfo( 'template_directory' ); ?>
-
∞ html5 template
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>untitled</title> </head> <body> </body> </html>
-
∞ 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')) );
-
∞ 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; }
-
∞ 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; }
-
∞ 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>
-
∞ 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>
-
∞ 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; }
-
∞ 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; }
-
∞ 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; }
-
∞ 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>
-
∞ AS3 Interface Class
package { public interface IMyInterface { } }
-
∞ AS3 Class File
package { import flash.display.MovieClip; public class MyClass extends MovieClip { public function MyClass() { } } }
-
∞ 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)
-
∞ Resharper mock declaration
/// <summary> /// The mock I$arg$ object. /// </summary> private I$arg$ _mock$arg$;
-
∞ Resharper argument out of range exception
if ($arg$ < 1) throw new ArgumentOutOfRangeException("$arg$");
-
∞ Resharper string argument null
if (string.IsNullOrEmpty($arg$)) throw new ArgumentNullException("$arg$");
-
∞ Resharper argument null template
if ($arg$ == null) throw new ArgumentNullException("$arg$");
-
∞ 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>
-
∞ 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);


