Skip to content

Instantly share code, notes, and snippets.

View JonathanTurnock's full-sized avatar

Jonathan Turnock JonathanTurnock

  • Manchester, United Kingdom
View GitHub Profile
@JonathanTurnock
JonathanTurnock / python-selenium-json_placeholder.py
Created December 22, 2019 21:52
Python Selenium Json Placeholder Interaction
import time
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.chrome.options import Options
if __name__ == '__main__':
# 1. Optional Options (Useful for development testing)
options = Options()
options.add_argument("--disable-web-security")
@JonathanTurnock
JonathanTurnock / Movement.cs
Created May 16, 2020 16:57
Simple Vector2 Movement BaseClass
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
[SerializeField] public float speed = 1f;
private List<Transform> waypoints = new List<Transform>();
@JonathanTurnock
JonathanTurnock / README.md
Created October 19, 2020 09:53
Get Current Jenkins Git Commit Hash

To Display the current git commit hash execute the following snipped:

git rev-parse --short HEAD

To Extract this to use in a Jenkinsfile use the sh function with the script and returnStdout parameter set to true:

def commitHash = sh(script: 'git rev-parse --short HEAD', returnStdout: true)
@JonathanTurnock
JonathanTurnock / RandomPatrol.md
Last active December 1, 2020 22:45
Arma 3 Cheatsheet

Initiate Random Patrol

Add the following to the init field of the Team Leader.

To ensure the units start from a random location, update the groups placement radius to match the distance field

[group this, getPos this, 1000] call BIS_fnc_taskPatrol;
@JonathanTurnock
JonathanTurnock / App.tsx
Created January 11, 2021 19:01
CSS Grid Example
import React from "react";
import styled from "styled-components";
const Scene = styled.div`
flex: auto;
display: grid;
grid-template-rows: 48px auto;
overflow: hidden;
& > div,
@JonathanTurnock
JonathanTurnock / README.md
Last active March 7, 2021 12:58
VLC media player Convert & Save DVD Chapters

Intro

How to use VLC media player to export a DVD in a file per chapter format

The command for reference is:

vlc dvdsimple:///G:/#1:1-1:1 --sout "#standard{access=file,mux=ts,dst=T1_CH1.mpg} vlc://quit"

The important part is the addition of a "to" section that the GUI does not allow.

@JonathanTurnock
JonathanTurnock / README.md
Last active March 15, 2021 18:48
Centos 8 WS Setup
@JonathanTurnock
JonathanTurnock / README.md
Last active August 30, 2021 19:30
JS implementation Dijkstra's Algorithm
@JonathanTurnock
JonathanTurnock / to-url-string.test.ts
Created January 8, 2023 21:35
Snippet for url conversion
import { toUrlString } from "./to-url-string";
describe("toUrlString", () => {
it("should transform a basic url", () => {
expect(toUrlString({ path: "/people" })).toEqual("/people");
});
it("should transform a colon parameterised url", () => {
expect(toUrlString({ path: "/people/:id", params: { id: 1 } })).toEqual("/people/1");
});
@JonathanTurnock
JonathanTurnock / App.jsx
Last active January 22, 2023 13:10
React RXJS Subject State https://playcode.io/1088821
import React from 'react';
import { BehaviorSubject } from 'rxjs';
import { useObservable } from 'react-use';
const subject = new BehaviorSubject(1);
const useSubjectState = (subject) => [useObservable(subject), (value) => subject.next(value)]
const Increment = () => {
const [state, setState] = useSubjectState(subject);