Skip to content

Instantly share code, notes, and snippets.

View leegee's full-sized avatar

Lee Goddard leegee

View GitHub Profile
@leegee
leegee / login-with-google.js
Last active October 23, 2019 13:39
Protractor Google OAuth2 Manual Sign-in
loginWithGoogle(
process.env.PROJ_TEST1_GMAIL_USER,
process.env.PROJ_TEST1_GMAIL_PASS
)
/**
* Uses the dreaded `sleep` method because finding the password
* by any css selector tried fails.
* @param {string} username - A Google username.
* @param {string} passphrase - A Google passpharse.
@leegee
leegee / jwt.pl
Last active November 13, 2017 07:03
Google REST API with Perl JSON::WebToken
use strict;
use warnings;
require JSON::XS;
require JSON::WebToken;
require LWP::UserAgent;
my $google_ua = signin_with_google(
service_account_id => $SERVICE_AC_ID,
private_key => $PRIVATE_KEY,
@leegee
leegee / eg.pl
Created November 13, 2017 08:51
Verify Google User with Perl
# @see https://developers.google.com/identity/sign-in/web/backend-auth
sub verify_with_google {
my $self = shift;
my $res = LWP::UserAgent->new()->get(
'https://www.googleapis.com/oauth2/v3/tokeninfo?id_token='
. $self->{id_token}
);
if ($res->is_success() and
$res->decoded_content =~ /"aud"\s*:\s*"$self->{client_id}"/
) {
@leegee
leegee / jwt.js
Last active November 16, 2017 09:49
Google Auth with Node.js JWT
const fetch = require('node-fetch');
const FormData = require('form-data');
const JSONWebToken = require('jsonwebtoken');
const getAuthToken = async function (args){
args.duration = args.duration || 60;
args.scope = args.scope instanceof Array? args.scope.join(' ') : args.scope;
let form = new FormData();
form.append('grant_type', 'urn:ietf:params:oauth:grant-type:jwt-bearer');
form.append('scope', args.scope);
@leegee
leegee / language-chooser.css
Created December 22, 2017 09:47
CSS List item bullets with CSS background images
// Where flags.png is a sprite of 25x15 px images
// <nav id="language-selection"><ul><li class='en'>
#language-selection {
margin-left: 2em;
}
#language-selection ul {
list-style-type: none;
margin-left: 0;
padding-left: 0;
@leegee
leegee / gist:5e44b0205ef820925d2e659cf6f33991
Created February 13, 2018 07:28
webpackge.devserver.proxy.config.js
config.APIS.endpoints.reduce((acc, cv) => {
acc[`/onewssi/${cv}/v1`] = {
secure: false,
headers: config.APIS.proxyHeaders,
bypass: (req, res, proxyOptions) => {
// May re-write, rather than bypass, to serve mock data basd on req URI
let rv = false;
let found = true;
if (req.url.indexOf('/mock') == -1
@leegee
leegee / x.json
Created February 15, 2018 08:15
vs code workspace colours
{
"editor.fontFamily": "Source Code Pro",
"editor.tokenColorCustomizations": {},
"window.zoomLevel": 1,
"editor.fontSize": 14,
"editor.tabSize": 2,
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 120,
"editor.cursorStyle": "block",
"eslint.alwaysShowStatus": true,
@leegee
leegee / front-page.html
Created May 21, 2020 09:46
Cycle quotes with CSS fade
<div id='frontpage-quote'></div>
@leegee
leegee / tip.css
Last active June 15, 2020 10:33
Show/hide tips
.tutorial-tip {
display: none;
background: var(--theme-toolip-bg);
color: var(--theme-link-toolip-fg);
font-size: 12pt;
padding: 1em;
position: absolute;
z-index: 2000;
width: auto;
min-width: 20em;
@leegee
leegee / install-tippecanoe-on-windows.md
Created October 10, 2023 09:19 — forked from ryanbaumann/install-tippecanoe-on-windows.md
Install Tippecanoe to make Mapbox Vector Tiles on a Windows 10 OS machine

Problem

Tippecanoe is an open source command line tool for creating Mapbox Vector Tiles. It runs only on unix environments like MacOS and Linux - so if you need to make maps with large vector data from geojson, shapefiles, or similar - you're hosed if you're on Windows.

Goals

  1. Create vector tiles of massive vector data on a Windows 10 machine

Requirements