Skip to content

Instantly share code, notes, and snippets.

View brianherbert's full-sized avatar
🎯
Focusing

Brian Herbert brianherbert

🎯
Focusing
View GitHub Profile
@brianherbert
brianherbert / docker-destroy-all.sh
Created May 9, 2019 14:17 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@brianherbert
brianherbert / index.html
Created May 9, 2019 14:15
Replace broken source image with img src in picture element
<html>
<head>
<title>Picture Test</title>
</head>
<body>
<p>
<picture>
<!--[if IE 9]><video style="display: none;"><![endif]-->
@brianherbert
brianherbert / convert.sh
Last active May 14, 2019 17:05
Convert files to webp
for file in ./**/*.png ; do cwebp -q 80 "$file" -o "${file%.png}.webp"; done
for file in ./**/*.jpg ; do cwebp -q 80 "$file" -o "${file%.jpg}.webp"; done
for file in ./**/*.jpeg ; do cwebp -q 80 "$file" -o "${file%.jpeg}.webp"; done
<?php
const SLACK_TOKEN = '';
const SLACK_CHANNEL = '#worldcup';
const SLACK_BOT_NAME = 'World Cup';
const SLACK_BOT_AVATAR = 'https://i.imgur.com/Pd0cpqE.png';
function curl_get($url) {
$curl = curl_init();
curl_setopt_array($curl, array(

Keybase proof

I hereby claim:

  • I am brianherbert on github.
  • I am brianherbert (https://keybase.io/brianherbert) on keybase.
  • I have a public key ASC8_DZ_YQMo3bEXiUeZA2kqIK9L7oniKEJ6gBLNjJxsfgo

To claim this, I am signing this object:

@brianherbert
brianherbert / install_v3.sh
Last active September 26, 2015 11:12
Current Ushahidi v3 install steps as of Jul 22, 2014
# Assumptions: You have vagrant and VirtuaBox installed on your machine
# Virtual Box https://www.virtualbox.org/
# Vagarant http://www.vagrantup.com/
# Get the Ushahidi Platform from GitHub and stick it in a directory
mkdir v3install
cd v3install
git clone [email protected]:ushahidi/platform.git
cd platform
@brianherbert
brianherbert / twit.js
Last active January 1, 2016 02:29
Parse through Twit reposes in Meteor
var fut = new Future();
var screen_name = Meteor.user().profile.twitterHandle;
Twit.get('statuses/user_timeline', { screen_name: screen_name, include_rts: false, count: 200 }, function(err, tweets) {
var i;
for (i = 0; i < tweets.length; ++i) {
if(tweets[i].geo != null) {
var geo = {lat: tweets[i].geo.coordinates[0], lon: tweets[i].geo.coordinates[1]};
fut['return'](geo);
return;
@brianherbert
brianherbert / filter-table.js
Created September 10, 2013 01:03
Filters a table based on data attributes
// This script is for supporting forms with searchable filters to show/hide rows of the table
$(document).ready(function() {
root.filters = [];
$('.filter-table-filters').find('td').each(function(i) {
var tdKey = 'td'+i;
$(this).data('filters',tdKey);
@brianherbert
brianherbert / .htaccess
Created September 9, 2013 13:44
Example Ushahidi .htaccess file
# Turn on URL rewriting only when mod rewrite is turn on
<IfModule mod_rewrite.c>
RewriteEngine On
# Installation directory
RewriteBase /
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system|tests|sql) - [F,L]
@brianherbert
brianherbert / gist:6086052
Last active December 20, 2015 06:29
Format for CSV files importing into Crowdmap
Format:
(posting user) (map id if owned by map) (post message) (lat) (lon) (alt) (location name) (date posted) (duh) (a map to attach this post to)
user_id, owner_map_id, message, lat, lon, altitude, location_name, date_posted, public, posts_maps_map_id
|
|
Note: must include altitude although it isn't
actually being inserted. You can use "0" as
a default value