Skip to content

Instantly share code, notes, and snippets.

View bravelocation's full-sized avatar
🏠
Working from home

John Pollard bravelocation

🏠
Working from home
View GitHub Profile
@bravelocation
bravelocation / Coronavirus widget.js
Last active November 25, 2020 16:25
Scriptable widget to show Northumberland Covid figures
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: user-md;
// Change these variables to get for your region (you'll have to hack the website to find the code for your region)
const areaCode = 'E06000057';
const areaName = 'Northumberland';
const url = 'https://api.coronavirus.data.gov.uk/v2/data?areaType=utla&areaCode=' + areaCode + '&metric=newCasesBySpecimenDateRollingRate&format=json';
const req = new Request(url);
---
layout: post
title: Writing a Category Index Page for Jekyll
categories: [blogging, jekyll]
---
---
layout: page
title: Posts by Category
---
{% capture get_items %}
{% for cat in site.categories %}
{{ cat | first | replace: ' ', '_' }}
{% endfor %}
{% endcapture %}
@bravelocation
bravelocation / Pushing data to Twitter
Created March 2, 2013 10:22
Code used by script to push MSFT share price in GBP to Twitter - see http://www.bravelocation.com/aboutmsftingbp and @msft_in_gbp
import urllib
import urllib2
import base64
class SimpleTwitterUpdate():
def __init__(self, userName, passWord):
self.username = userName
self.password = passWord
self.twitterUrl = 'http://twitter.com/statuses/update.xml'
@bravelocation
bravelocation / Reading data from Google Spreadsheet
Created March 2, 2013 10:15
Code used by script to push MSFT share price in GBP to Twitter - see http://www.bravelocation.com/aboutmsftingbp and @msft_in_gbp
import gdata.spreadsheet.service
import gdata.alt.appengine
class StockData():
def __init__(self, runningOnAppEngine):
self.client = gdata.spreadsheet.service.SpreadsheetsService()
if (runningOnAppEngine):
gdata.alt.appengine.run_on_appengine(self.client)
self.client.email = "johnp@bravelocation.com"
@bravelocation
bravelocation / JQuerySlideshow.js
Created June 9, 2012 15:36
Simple JQuery Slideshow
<!-- Slideshow courtesy of http://snook.ca/archives/javascript/simplest-jquery-slideshow - with slight amendment to add in pause/play functionality -->
<style>
.fadein { position:relative; height:300px; width:500px; }
.fadein img { position:absolute; left:0; top:0; }
</style>
<script>
var enableSlideshow = true;