Skip to content

Instantly share code, notes, and snippets.

@alextea
alextea / gist:4586740
Created January 21, 2013 15:13
Javascript snippet to track pixel density ratio.
// track pixel density ratio
if (window.devicePixelRatio) {
_gaq.push(['_setCustomVar', 11, 'Pixel Ratio', String(window.devicePixelRatio), 2 ]);
}
@alextea
alextea / _alpha-banner.html
Last active December 27, 2015 02:19
Fix class name
<!-- insert this after the #global-header block -->
<div class="alpha-banner">
<p>
<b>ALPHA:</b> This is a prototype – your <a href="">feedback</a> will help us to improve it. <a href="#">Find out more</a>
</p>
</div>
@alextea
alextea / highlightcells.js
Created June 25, 2015 16:49
Function to extract numeric data from mixed content cells and apply a heatmap to them in Google Sheets
function highlightcells() {
var sheet = SpreadsheetApp.getActiveSheet();
var allData = sheet.getDataRange();
var dataRange = sheet.getRange(2,3,allData.getLastRow(),allData.getLastColumn());
var data = dataRange.getValues();
// iterate over data
var values = [];
for (var i = 0; i < data.length; i++) {
@alextea
alextea / top-records-2015.md
Last active December 11, 2015 15:37
Top records & reissues 2015
@alextea
alextea / gist:12ecab18cc3ebebb86fe7064e4801fa1
Last active April 6, 2016 13:47
Regular expressions for converting mustache to nunjucks
# template tag
\{\{<([^}]+)\}\}
{% extends "$1.html" %}
# includes tag
\{\{>([^}]+)\}\}
{% include "$1.html" %}
# block tag
\{\{\$([^}]+)\}\}
@alextea
alextea / rgb_test.py
Created December 3, 2016 16:08
Cycle through R, G and B on a single neopixel
# NeoPixel library strandtest example
# Author: Tony DiCola (tony@tonydicola.com)
#
# Direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
import time
from neopixel import *
# LED strip configuration:
LED_COUNT = 50 # Number of LED pixels.
<div class="grid-row">
<div class="available-languages">
<ul>
<li class="translation">
<span>English</span>
</li>
<li class="translation last">
<a lang="cy" hreflang="cy" href="/dechrau">Cymraeg</a>
</li>
</ul>
@alextea
alextea / crests.txt
Created June 5, 2018 14:46
Organisations using images where we should be using the single identity logo
RPA
https://www.gov.uk/government/organisations/rural-payments-agency
https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/58/RPA_582_SML_AW-_12mm-crest___Ex_.jpg
APHA
https://www.gov.uk/government/organisations/animal-and-plant-health-agency
https://assets.publishing.service.gov.uk/government/uploads/system/uploads/organisation/logo/1079/A_PHA_582_AW.png
UK Hydrographic Office
https://www.gov.uk/government/organisations/uk-hydrographic-office
@alextea
alextea / .bash_profile
Last active June 12, 2018 13:14
My bash profile with minimal prompt
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:~/.local/bin:$PATH"
source ~/.git-completion.bash
# Get the name of the branch we are on
git_prompt_info() {
branch_prompt=$(__git_ps1)
if [ -n "$branch_prompt" ]; then
echo $branch_prompt
@alextea
alextea / c64.md
Last active August 22, 2018 15:20
Commodore 64 with games & accessories for sale

Commodore 64

Hardware:

  • Commodore 64
  • Power supply
  • Datasette Tape Deck
  • Atari joystick controller

Games: