Skip to content

Instantly share code, notes, and snippets.

View thomedes's full-sized avatar

Toni Homedes i Saun thomedes

  • Tarragona, Spain
View GitHub Profile
@thomedes
thomedes / is_assoc_array.php
Last active December 19, 2015 19:48
php: Check if an array is associative or plain
<? php
function is_assoc_array($a) {
return (is_array($a)
&& (array_keys($a) !== range(0, count($a) - 1)));
}
function is_plain_array($a) {
return is_array($a) && !is_assoc_array($a);
}
@thomedes
thomedes / browser-x-load.js
Last active August 29, 2015 13:57
Load any file in the browser
///////////////////////////////////////////////////////////////////////////////
//
// browser_x_loader(tag_name, element_type, callbak[, end_callback])
//
// Load files in the browser
//
// Usage:
//
// <script type="text/x-toni-template" src="tmpl/default.tmpl"></script>
// <script type="text/x-toni-template" src="tmpl/login.tmpl"></script>
@thomedes
thomedes / print_r.js
Last active August 29, 2015 13:57
Javascript PHP's print_r()
//-----------------------------------------------------------------------------
//
// print_r(expression[, _return = false ])
//
// PHP's print_r() implemented in javascript
//
// Usage:
// alert(print_r([111, {a: 33, b: 44}], true))
//
// if _return is true will return string