Skip to content

Instantly share code, notes, and snippets.

View bgaeddert's full-sized avatar

Brian Gaeddert bgaeddert

  • Brian's Stuff
  • USA & Costa Rica
View GitHub Profile
@bgaeddert
bgaeddert / disable_rebootdms.sh
Last active April 25, 2025 18:17
disable_rebootdms.sh
#!/bin/bash
# Enable command tracing to print commands as they run
set -x
# Default values if not provided
SERVER_URL=${1:-"https://local-cronicle.schoolcurrent.net:8443"}
API_KEY=${2:-"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
# Display which server and API key we're using
@bgaeddert
bgaeddert / Mongo-Json-Groovy.json.groovy
Created February 4, 2025 12:40
Mongo-Json-Groovy.json.groovy
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@bgaeddert
bgaeddert / PHP-array-equivalence.php
Created May 9, 2019 18:52
PHP array equivalence
<?php
// Single Dimension
$a = ['asdf', 'fdsa'];
$b = ['ASDF', 'FDSA'];
$c = ['asdf', 'fdsa'];
echo '$a = $b? => ' . (($a == $b)?'true':'false');
echo PHP_EOL;
echo '$a = $c? => ' . (($a == $c)?'true':'false');
@bgaeddert
bgaeddert / Email Header Regex
Created October 7, 2016 04:54
Splits an email header
/([A-Za-z-]+):\s([^\r\n]+(?:\r?\n(?![A-Za-z-]+:\s)[^\r\n]+)*)/mx
@bgaeddert
bgaeddert / Angular filter in controller
Last active March 7, 2016 13:44
Filter object with array elements by property in angular controller/javascript
products = {
[
"id" : 1
"type" : "Internal Use"
],
[
"id" : 2
"type" : "public"
]
}
.filter('trust', [
'$sce',
function($sce) {
return function(value, type) {
// Defaults to treating trusted text as `html`
return $sce.trustAs(type || 'html', value);
}
}
])
@bgaeddert
bgaeddert / onBreakPointChange.js
Created May 26, 2015 01:19
Foundation Zurb detect break point change
function onBreakPointChange(breakPoint){
// Put code here to run on any break point change.
// Ex. large to medium and medium to large and small to medium...
if (matchMedia(Foundation.media_queries['small']).matches){
// Put code here to run when page changes to small
}
if (matchMedia(Foundation.media_queries['medium']).matches){
// Put code here to run when page changes to medium
@bgaeddert
bgaeddert / equalize.js
Last active August 29, 2015 14:15
Equalize element heights with jQuery
// For use with jQuery
// Example
equalize_heights('.row .box')
// This will make all the .box elements the same height.
function equalize_heights(elem){
// Get an array of all element heights
var elementHeights = $(elem).map(function() {
return $(this).height();
}).get();
@bgaeddert
bgaeddert / isMobile.js
Created December 26, 2014 21:20
Tests if browser is mobile
/**
*
* Tests if browser is mobile
*
* @returns {boolean}
*/
function isMobile() {
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
return true;
@bgaeddert
bgaeddert / getFeaturedImageUrlBySize.php
Last active August 29, 2015 14:09
Get featured image ( thumbnail ) URL by size - Wordpress
/**
*
* Wordpress
*
* Returns the url of a posts featured image by size.
*
* @param $post_id
* @param $size thumbnail,small,medium,large,full....
*
* @return mixed