Skip to content

Instantly share code, notes, and snippets.

View gryzzly's full-sized avatar

Misha Reyzlin gryzzly

View GitHub Profile
@gryzzly
gryzzly / gist:1364474
Created November 14, 2011 17:10
renderTemplate from DoAT Touchy, basic JS templating
// Render JavaScript template (from http://git.io/B7KxZg DoAT Touchy)
//
// You can place your template in a script tag with type other than "text/javascript"
// such as "text/html", like this:
// <script type="text/html" id="item-template">
// <li id="{{id}}">
// <p>{{content}}</p>
// </li>
// You'd then render your template like this:
// var itemTemplate = document.getElementById('item-template').innerHTML;
var reverseString = function ( subj ) {
var helper = subj.split (''),
i = 0, k = helper.length, len = helper.length / 2,
swap
for ( ; i < len; i += 1, k -= 1 ) {
swap = helper[ k ];
helper[ k ] = helper[ i ];
helper[ i ] = swap;
}