Skip to content

Instantly share code, notes, and snippets.

View howardgrigg's full-sized avatar

Howard Grigg howardgrigg

View GitHub Profile
<table id="episodes">
<% control orderedEpisodes %>
<tr class="$EvenOdd $FirstLast">
<% if Top.PagePerEpisode %>
<td class="episode-date"><a href="{$Top.Link}episode/{$ID}" title="$Title">$Date.Nice</a></td>
<td class="episode-title"><a href="{$Top.Link}episode/{$ID}" title="$Title">$Title<br />$Speaker <% if Duration %><span class="duration">($Duration <% _t('Mins','mins') %>)</span><% end_if %></a></td>
<% else %>
<td class="episode-date">$Date.Nice</td>
<td class="episode-title">$Title<br />$Speaker <% if Duration %><span class="duration">($Duration <% _t('Mins','mins') %>)</span><% end_if %></td>
#!/bin/sh
GIT_WORK_TREE=~/sites/testdeploy/ git checkout -f
cd ~/sites/testdeploy/
composer install
sake dev/build
sake / flush=all
@howardgrigg
howardgrigg / gist:d4d7abeb5aea4eb8e048
Created July 17, 2014 22:38
Get Youtube ID from URL
function YouTubeID(){
if($youtube_url = $this->YouTubeLink){
$url = parse_url($youtube_url);
if( $url['host'] !== 'youtube.com' &&
$url['host'] !== 'www.youtube.com'&&
$url['host'] !== 'youtu.be'&&
$url['host'] !== 'www.youtu.be')
return '';
#include <FastLED.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX
#define REDPIN 10
#define GREENPIN 11
#define BLUEPIN 9
#define BUTTONPIN 12
const byte numChars = 14;
#include <FastLED.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX
#define REDPIN 10
#define GREENPIN 11
#define BLUEPIN 9
#define BUTTONPIN 12
const byte numChars = 14;
func monthsOld(DOBStr: String) throws -> Int{
enum monthsOldError: Error{
case futureDate
}
let formatter = DateFormatter()
formatter.dateFormat = "yyyy/MM/dd"
let DOB = formatter.date(from: DOBStr)
let timesince: Double = DOB!.timeIntervalSinceNow
if timesince > 0.0{
throw monthsOldError.futureDate
let xPRIntervals: [Int: [Int: [Double]?]] = [
1:[
60: nil,
80: nil,
100: [0.1, 0.12]
],
6:[
60: nil,
140: [0.11, 0.14],
160: [0.1, 0.13]
let xPRIntervals: [Int: [Int: [Double]?]] = [
1:[
60: nil,
80: nil,
100: [0.1, 0.12]
],
6:[
60: nil,
140: [0.11, 0.14],
160: [0.1, 0.13]
var CalcAxis: Int{
var AxisValues = [Double]()
if inputLead1pos.double != nil{
AxisValues.append(Double(inputLead1pos) ?? 0)
}
if inputLead1neg.double != nil{
AxisValues.append(Double(inputLead1neg) ?? 0)
}
if inputLeadAVFpos.double != nil{
AxisValues.append(Double(inputLead1pos) ?? 0)
var CalcAxis: Int?{
func calculate() throws -> Int?{
var AxisValues = [Double]()
if inputLead1pos.double != nil{
AxisValues.append(Double(inputLead1pos) ?? 0)
}
if inputLead1neg.double != nil{
AxisValues.append(Double(inputLead1neg) ?? 0)
}
if inputLeadAVFpos.double != nil{