Skip to content

Instantly share code, notes, and snippets.

View TGNThump's full-sized avatar
👋

Ben Pilgrim TGNThump

👋
View GitHub Profile
@TGNThump
TGNThump / save.py
Created November 3, 2019 20:44 — forked from mickael9/save.py
Factorio map metadata parser
from zipfile import ZipFile
from struct import Struct
class Deserializer:
u16 = Struct('<H')
u32 = Struct('<I')
def __init__(self, stream):
self.stream = stream
@TGNThump
TGNThump / discord-custom.css
Last active April 26, 2020 16:47
Better Discord Custom CSS
.da-sidebar {
width: auto;
display: flex;
flex-direction: column;
}
.emoji.jumboable {
width: 2rem;
height: 2rem;
min-height: 2rem;
@TGNThump
TGNThump / using_git-svn.md
Last active August 22, 2019 08:03 — forked from rickyah/using_git-svn.md
A simple guide to git-svn

Getting started with git-svn

git-svn is a git command that allows using git to interact with Subversion repositories.git-svn is part of git, meaning that is NOT a plugin but actually bundled with your git installation. SourceTree also happens to support this command so you can use it with your usual workflow.

Reference: http://git-scm.com/book/en/v1/Git-and-Other-Systems-Git-and-Subversion

Cloning the SVN repository

You need to create a new local copy of the repository with the command

{
"Nigel Adams": "nadams",
"Sir David Amess": "amessd_southend",
"Mr Richard Bacon": "richardbaconmp",
"Sir Kevin Barron": "KevinBarronMP",
"Órfhlaith Begley": "OrfhlaithBegley",
"Ian Blackford": "IanBlackfordMP",
"Andrew Bowie": "AndrewBowieMP",
"Steve Brine": "BrineMP",
"Chris Bryant": "RhonddaBryant",
@TGNThump
TGNThump / COMP327.md
Created January 18, 2019 00:07
COMP327
  1. i. Forced unwrapping throws an error and crashes if an optional value in the chain is not present. Optional chaining stops the execution if the chain is broken by a not present value.

    ii. The Type of Optional Int is infered from the variabe assignment as none is specified. Adding a ! after the Int(myString) will force unwrap the value to a Int, which will then be infered as the type of the variable.

    The Int class has an initialiser method that takes a string composed of digits and converts them to an integer, but this can fail, so it returns an Int?

  2. Apple-Pay is more secure as it requires biometric verification to use, such as fingerprints (touch-id) or your face (face-id). All of the devices that use apple pay contain a "Secure Element" that keeps the customer information secure. Credit card numbers are never sent over the air.

@TGNThump
TGNThump / COMP309.md
Last active January 14, 2019 15:37
COMP309 Notes

Recursive Weighted Activity Selection

RWAS(j){
  if (j == 0) return 0
  else if (M[j] != null) return M[j]
  else {
    M[j] = max(w(A[j]) + RWAS(p(j)), RWAS(j-1))
    return M[j]
 }
0eNrcvetuXreSBPou/nkQGYt3cuNgXmQwCBRbsYWRL5DkzASDvPv5JFvSisVerKpWtIHzZybb9tdsNrtJLnZV9/+9+e3q28XX68vPt2/+9X9vLt99+Xzz5l//+X9vbi4/fD6/uvuz2z+/Xrz515vL24tPb3558/n8093/uvjfr9cXNzdnt9fnn2++frm+Pfvt4ur2zV+/vLn8/P7if9/8K/z1y1LIbxfnp/F2P4p//dcvby4+317eXl58V+P+f/z56+dvn367uD5Jffztzbffbm7Pby9Pv//lzdcvN5f3/3ka6STmrPS35Zc3f57+q6a35a87VX4SFH9W4rmQWn+I2O4UPCl+c/c3N18vLt6fffry/tvVxVm6U3kiPa2lF116XkvPuvSylh516XUtPejSG7CqsvC+FJ5l2WMpOyVZeNjW0nWzhLCWPnTp60DNUZe+DtRcdOnrQM1dl74O1BJ06etALbq7h3WglqZL76tjarJh/nDRMk7Dvb+8vnj3/W/jTP54Jv/b6fy6/nD95fT/zRG6McIvj4fj56/f7o7Q54fVJkwozYfLM/lBmlBeTejLt1trRk9h/fXy9G8n0uOj9Nnv099+f3b75ey7sjNJYa5nncnNuNyUCLmFkJtxV4wVlxsTIbcRciNhh47LDcy6DUJuxO2QNkIuITbAYjfcCCnCUhnbJjzWwkbYAA+1yJgWjzTGcVNdbFgpHO1XCY+nxNiw458xpfGfMbuD7uqkx/Xlu7Pfv11/Pn8327HrgwXq0UCnf/T1+vS/TrP64zTW/m+m3zob/iklzDAHZoblH5lhdNxW+lRiEiT2R4nLWMjZIb9NNS74J62yytVxf0IM0gT5eS5/dj/L3SG/AfKJ0/PxXjZ1vbIt73Xb4e8DcU8a+AqVSMxwO3LVQtw8U5lrONvKSxZuiMjMC7PD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Eh38QfGX9BsI/yvpdCPz
[query] => [select] + ' ' + [from] + ' ' + [where] + ';'
[query] => [select] + ' ' + [from] + ';'
[select] => 'SELECT ' + [selectList]
[from] => 'FROM ' + [fromList]
[where] => 'WHERE ' + [condition]
[selectList] => '*'
[selectList] => [selectElement] + [comma] + [selectList]
[selectList] => [selectElement]
<?php
namespace App\GraphQL\Controllers;
use Ratchet\MessageComponentInterface;
use Ratchet\WebSocket\WsServerInterface;
use GraphQL\Language\AST\DocumentNode;
use GraphQL\Language\Parser;
use GraphQL\Type\Schema;
use Ratchet\ConnectionInterface;
use Firebase\JWT\JWT;