Skip to content

Instantly share code, notes, and snippets.

View davebarnwell's full-sized avatar

Dave Barnwell davebarnwell

View GitHub Profile
davebarnwell / index.html
Last active October 24, 2022 14:35
add bar graph as background to html table column
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>HTML table with bar graph background in one or more columns</title>
<link rel="stylesheet" href="main.css">
<div class="grid">
<!-- ROW -->
davebarnwell / Colour.php
Last active December 15, 2022 09:30
Algorithm to create heatmap colors
View Colour.php
class Colour
* Maps a float value to a CSS HSL color
* 0 : blue
davebarnwell / uk_post_code.html
Created October 16, 2021 14:53 — forked from frontweb/uk_post_code.html
Plot a UK post code on Google Maps
View uk_post_code.html
<title>UK Post Code</title>
<style type="text/css">
#map_canvas { width:300px; height:200px; }
<script type="text/javascript">
function initialize() {
davebarnwell /
Created October 7, 2021 14:10 — forked from cagartner/
Laravel Push deploy Github actions example
set -e
(git push) || true
git checkout production
git merge master
View LogAfterRequest.php
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Log;
class LogAfterRequest {
public function handle($request, \Closure $next)
return $next($request);
davebarnwell /
Created May 6, 2020 14:25 — forked from loilo/
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`

const B = {

davebarnwell /
Last active February 11, 2019 10:21 — forked from subfuzion/
General REST API HTTP Status Codes

Reference: RFC 2616 - HTTP Status Code Definitions


  • 400 BAD REQUEST: The request was invalid or cannot be otherwise served. An accompanying error message will explain further. For security reasons, requests without authentication are considered invalid and will yield this response.
  • 401 UNAUTHORIZED: The authentication credentials are missing, or if supplied are not valid or not sufficient to access the resource.
  • 403 FORBIDDEN: The request has been refused. See the accompanying message for the specific reason (most likely for exceeding rate limit).
  • 404 NOT FOUND: The URI requested is invalid or the resource requested does not exists.
  • 406 NOT ACCEPTABLE: The request specified an invalid format.
davebarnwell /
Last active September 7, 2018 09:37
PHPUnit seed

base PHPUnit directory structure

Assumes following dir structure

  ./vendor                  # composer pulling in phpunit
  ./tests                   # directory containing tests namespace prefix \Test\...
  ./tests/            # This script
  ./tests/phpunit.xml.dist  # PHPUnit xml config
 ./tests/bootstrap.php # bootstrap for php Tests
View BBC-Radio.m3u
#EXTINF:-1,BBC - Radio 1
#EXTINF:-1,BBC - Radio 2
#EXTINF:-1,BBC - Radio 3
#EXTINF:-1,BBC - Radio 4
#EXTINF:-1,BBC - Radio 5 live
davebarnwell / StrCSV.php
Last active April 24, 2018 16:18
get and put CSVs from a string instead of a file
View StrCSV.php
class StrCSV
public function strPutCsv($input, $delimiter = ',', $enclosure = '"')
// Open a memory "file" for read/write...
$fp = fopen('php://memory', 'r+');
// ... write the $input array to the "file" using fputcsv()...
fputcsv($fp, $input, $delimiter, $enclosure);
// ... rewind the "file" so we can read what we just wrote...