Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple JavaScript Templating | |
// John Resig - https://johnresig.com/ - MIT Licensed | |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple JavaScript Templating | |
// John Resig - http://ejohn.org/ - MIT Licensed | |
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we’re getting a template, or if we need to | |
// load the template – and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || | |
tmpl(document.getElementById(str).innerHTML) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
function sort_nested_arrays( $array, $args = array('votes' => 'desc') ){ | |
usort( $array, function( $a, $b ) use ( $args ){ | |
$res = 0; | |
$a = (object) $a; | |
$b = (object) $b; | |
foreach( $args as $k => $v ){ | |
if( $a->$k == $b->$k ) continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* JSS | |
* Author: Jared Abbott | |
* Copyright 2015 Jared Abbott | |
* Distributed under the MIT license | |
* | |
* @param {Object} | |
*/ | |
var _jss = function(jss, combinator) { | |
var _toString = Function.prototype.call.bind(Object.prototype.toString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* xhrBinary.js | |
* Author: Jared Abbott | |
* Copyright 2015 Jared Abbott | |
* Distributed under the MIT license | |
*/ | |
var xhrBinary = function(url, fn) { | |
// RESOURCES | |
// http://mgran.blogspot.com/2006/08/downloading-binary-streams-with.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Jared Abbott | |
// Created: December 2015 | |
// License: MIT | |
var template = function(tpl, data) { | |
// Make sure the cache is available | |
var w = window; | |
w.tplCache = !w.tplCache ? {} : w.tplCache; | |
// Prepare and load the template | |
tpl = ('"' + tpl.replace(/\{\{(.*?)\}\}/g, '"+$1+"') + '"').split(/\'+ | + \'/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var cache = {}; | |
this.tmpl = function tmpl(str, data){ | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || | |
tmpl(document.getElementById(str).innerHTML) : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# powershell XOR encoder / decoder and hex / byte - byte / hex conversions | |
# usage: execute & see output | |
# xor encoder / decoder | |
function xor($bytes, $string) { | |
$newBytes = @(); | |
for ($i = 0; $i -lt $bytes.Count; $i++) { | |
$newBytes += $bytes[$i] -bxor $string[$i % $string.Length]; | |
} | |
return $newBytes; |
NewerOlder