Skip to content

Instantly share code, notes, and snippets.

View davebarnwell's full-sized avatar

Dave Barnwell davebarnwell

View GitHub Profile
@davebarnwell
davebarnwell / index.html
Last active November 6, 2015 13:39
javascript countdown timer
<html>
<head>
<title>count down clock</title>
<style>
body{
text-align: center;
background: #00ECB9;
font-family: sans-serif;
font-weight: 100;
}
@davebarnwell
davebarnwell / brew-dnsmasq.md
Last active March 3, 2026 22:10
install dnsmasq with brew

Install dnsmasq and configure for *.dev.local domains

$ brew install dnsmasq
$ vim /usr/local/etc/dnsmasq.conf

Reload configuration and clear cache

# Copy the daemon configuration file into place.
$ sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/

$ sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

@davebarnwell
davebarnwell / installapps.sh
Last active January 31, 2016 10:55
Setup a mac from command line using brew and cask
#Install some apps with Cask
# Apps
apps=(
google-drive
sourcetree
picasa
charles
handbrake
)
@davebarnwell
davebarnwell / capture.js
Created January 31, 2016 11:20
Screen capture a webpage with phantomjs
//
// Screen shot a webpage using phantomjs
//
// phantomjs capture.js url filename.png
//
var page = require('webpage').create(),
system = require('system'),
url, img_filename_output;
if (system.args.length < 3) {
@davebarnwell
davebarnwell / README.md
Created February 5, 2016 15:26 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@davebarnwell
davebarnwell / apitest.php
Created March 1, 2016 22:08 — forked from karlkranich/apitest.php
Updated PHP code to use the Google Sheets API. See usage instructions at http://karl.kranich.org/2015/04/16/google-sheets-api-php/
<?php
require_once realpath(dirname(__FILE__) . '/vendor/autoload.php');
include_once "google-api-php-client/examples/templates/base.php";
$client = new Google_Client();
/************************************************
ATTENTION: Fill in these values, or make sure you
have set the GOOGLE_APPLICATION_CREDENTIALS
@davebarnwell
davebarnwell / oembed.php
Last active January 3, 2023 17:10
php generate embed (video embed) info for a given youtube or vimeo url
<?php
/**
* Class Oembed
*/
class Oembed
{
/**
* Given a vimeo or youtube URL get the oembed info
*
@davebarnwell
davebarnwell / google_analytics_via_service_account.php
Last active March 26, 2016 21:48
Connect to google analytics using the google php client and a service account key
<?php
/**
* include via composer Google client lib
* composer require google/apiclient:^2.0.0@RC
* include the autoload.php
*
* Create a service account key in the google developer console
* and download the key file into your project above the web root somewhere
*/
@davebarnwell
davebarnwell / mysql-db-size.sql
Last active May 26, 2016 14:07
MySQL database size with an SQL query (or How big is my MySQL database?)
SELECT table_schema "_REPLACE_WITH_DB_NAME_",
sum( data_length + index_length ) / 1024 /
1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;
@davebarnwell
davebarnwell / README.md
Last active June 12, 2016 07:51
Wordpress container with docker compose

Wordpress container with docker compose

Create a project directory

mkdir my-project
cd my-project

Then copy/create the docker-compose.yml into the project directory

From your project directory start up your containers by running