Skip to content

Instantly share code, notes, and snippets.

View RobinL's full-sized avatar

Robin Linacre RobinL

View GitHub Profile
@RobinL
RobinL / phaser.md
Created March 30, 2025 15:24
Phaser instructions html form

Okay, here are specific and precise instructions, with code snippets, outlining the general pattern for integrating an HTML form with a Phaser 3 game, managing keyboard focus correctly.

This pattern ensures:

  1. Keyboard input intended for the HTML form (typing, arrow keys for navigation/value changes) works correctly when an input is focused.
  2. Phaser does not receive or react to keyboard input while the form is being edited.
  3. Submitting the form (via Enter key or clicking an update button) updates the Phaser game.
  4. Keyboard focus and control return to the Phaser game after submission.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RobinL
RobinL / edges_data.json
Last active October 11, 2023 14:47
splink3_cluster_studio
This file has been truncated, but you can view the full file.
import requests
import json
import pandas as pd
from io import StringIO
import time
url = "https://api.beta.ons.gov.uk/v1/filters?submitted=true"
ages = range(0,90)
ages = [str(a) for a in ages]
years = [2015,2016,2017]
@RobinL
RobinL / get_data.py
Created February 9, 2019 16:16
Filter api example
import requests
import json
import pandas as pd
from io import StringIO
import time
url = "https://api.beta.ons.gov.uk/v1/filters?submitted=true"
post = {
"dataset": {
{"$schema": "https://vega.github.io/schema/vega/v3.0.json",
"width": 500,
"height": 600,
"autosize": "none",
"signals": [
{
"name": "translate0",
"update": "width / 2"
},
{
@RobinL
RobinL / random_tasks.py
Created July 14, 2018 08:41
DAG dynamically generating tasks
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2018,10,1),
{
"quoteResponse": {
"result": [
{
"currency": "USD",
"esgPopulated": false,
"exchange": "CCY",
"exchangeDataDelayedBy": 0,
"exchangeTimezoneName": "Europe/London",
"exchangeTimezoneShortName": "GMT",
@RobinL
RobinL / testschema.json
Last active February 24, 2018 09:37
testschema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"title": "Metadata",
"description": "MoJ Data Catalogue Metadata",
"properties": {
"id": {
"type": "string",
"title": "The ID of this table. Unique identifier which enables a table's metadata to refer to another table using e.g. for a foreign key",
"examples": [
@RobinL
RobinL / add_pk_to_sqlite_table.py
Created November 17, 2017 09:14
Add a primary key to a sqlite table
import re
def get_create_table_string(tablename, connection):
sql = """
select * from sqlite_master where name = "{}" and type = "table"
""".format(tablename)
result = connection.execute(sql)
create_table_string = result.fetchmany()[0][4]
return create_table_string