Skip to content

Instantly share code, notes, and snippets.

@bmcalister
bmcalister / timelapse.sh
Last active April 22, 2021 19:43
timelapse
#!/bin/bash
NAME=$(date +%Y-%m-%d--%H.jpg)
echo "downloading $NAME"
curl "http://192.168.1.47/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=a&user=admin&password=K3ssl3r\!9" --output $NAME
gupload $NAME
rm $NAME
@bmcalister
bmcalister / wordpress-nested-nav.php
Last active March 6, 2023 13:07
One dimensional wordpress nav object to nested array
<?php
class Nested_nav {
public $wp_nav;
public $nested_nav;
function __construct($menu, $args = null) {
$this->wp_nav = wp_get_nav_menu_items($menu, $args);
$this->nested_nav = $this->buildTree( $this->wp_nav );
@bmcalister
bmcalister / gist:d88401c1a25279c9e610
Last active August 29, 2015 14:15
jQuery selector cache
window._$ = (function($, undefined){
var cache = [];
return function(selector, update) {
if( cache[ selector ] === undefined || update === true ) {
cache[ selector ] = $(selector);
}
return cache[ selector ];
}
})(jQuery);