Skip to content

Instantly share code, notes, and snippets.

View davebarnwell's full-sized avatar

Dave Barnwell davebarnwell

View GitHub Profile
@davebarnwell
davebarnwell / deploy.sh
Created July 12, 2024 09:43 — forked from BenSampo/deploy.sh
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@davebarnwell
davebarnwell / index.html
Last active October 24, 2022 14:35
add bar graph as background to html table column
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML table with bar graph background in one or more columns</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="grid">
<!-- ROW -->
@davebarnwell
davebarnwell / Colour.php
Last active December 15, 2022 09:30
Algorithm to create heatmap colors
<?php
class Colour
{
/**
* Maps a float value to a CSS HSL color
*
* 0 : blue
@davebarnwell
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
<html>
<head>
<title>UK Post Code</title>
<style type="text/css">
#map_canvas { width:300px; height:200px; }
</style>
<script type="text/javascript">
function initialize() {
@davebarnwell
davebarnwell / deploy.sh
Created October 7, 2021 14:10 — forked from cagartner/deploy.sh
Laravel Push deploy Github actions example
#!/bin/sh
set -e
vendor/bin/phpunit
(git push) || true
git checkout production
git merge master
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Log;
class LogAfterRequest {
public function handle($request, \Closure $next)
{
return $next($request);
}
@davebarnwell
davebarnwell / pass-slots.md
Created May 6, 2020 14:25 — forked from loilo/pass-slots.md
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
davebarnwell / http-status-codes.md
Last active February 11, 2019 10:21 — forked from subfuzion/http-status-codes.md
General REST API HTTP Status Codes

Reference: RFC 2616 - HTTP Status Code Definitions

General

  • 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
davebarnwell / README.md
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/run.sh            # This script
  ./tests/phpunit.xml.dist  # PHPUnit xml config
 ./tests/bootstrap.php # bootstrap for php Tests
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live