Skip to content

Instantly share code, notes, and snippets.

View mgirouard's full-sized avatar
🤘

Michael Girouard mgirouard

🤘
View GitHub Profile
@mgirouard
mgirouard / destroy-sample-data.php
Created October 1, 2010 02:02
A quick hack to destroy all sample data in an OpenCart catalog.
<?php
$options = getopt('p:');
$prefix = empty($options['p'])
? realpath('.')
: realpath($options['p']);
if (empty($prefix)) {
die("Bad prefix. Try again.\n");
}
@mgirouard
mgirouard / guzzle-exceptions.md
Created July 17, 2016 00:36
GuzzleHttp Exception Hierarchy
  • GuzzleException
    • SeekException
    • TransferException
      • RequestException ( RequestInterface ; ResponseInterface | null )
        • TooManyRedirectsException
        • ConnectException
        • BadResponseException
          • ServerException
  • ClientException
@mgirouard
mgirouard / states.html
Last active September 21, 2018 16:09
US State List
<select name="state">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
@mgirouard
mgirouard / Makefile
Created July 24, 2017 20:47
`make`ing with wildcard prereqs
consumers.go: $(wildcard data/consumers/*.pub)
ls -l data/consumers > consumers.go
cat consumers.go
clean:
rm -rf consumers.go data/consumers/*.pub
@mgirouard
mgirouard / docker-compose.yml
Created September 14, 2016 19:03
prometheus in a box
version: '2'
volumes:
metric_data: {}
networks:
metrics:
driver: bridge
services:
@mgirouard
mgirouard / vbox-list-ips.sh
Created September 8, 2016 05:31
Get VirtualBox IPs for a given VM
# http://superuser.com/a/634198
VBoxManage guestproperty enumerate $1 | grep IP
@mgirouard
mgirouard / QA.md
Last active April 29, 2016 17:55
99 QA Points for Symfony projects, via https://insight.sensiolabs.com/what-we-analyse

Critical Checks

Security

  • Projects must not depend on dependencies with known security issues
  • Database queries should use parameter binding
  • PHP debug statements found
  • eval() should never be used
@mgirouard
mgirouard / excerpt.php
Created January 21, 2014 17:55
A different way of handling excerpts. Inspired by WP.
<?php
function get_excerpt($input, $length = 250)
{
return current(explode("\n", wordwrap($input, $length)));
}
<?php // via http://stackoverflow.com/questions/11657835
$onlyIds = array_map('current', $results);
set_acl_permissions: