Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Coding or something, probably

William Mathewson neanias

👨‍💻
Coding or something, probably
  • Edinburgh, UK
View GitHub Profile
@neanias
neanias / README.md
Last active Jul 3, 2020
General purpose vimrc for Ruby & Rails editing
View README.md

General purprose vimrc

Designed for Ruby & Rails editing

Installation

There are 2 options for this:

1. Clone the repo

@neanias
neanias / mettle_practice_managed_report.rb
Last active Mar 26, 2020
Production script for generating a CSV of practice managed Mettle-resold companies. Pending Looker report.
View mettle_practice_managed_report.rb
switch_to_slave_db
require "csv"
headers = ["Name", "Email", "Subdomain", "Bank Account ID", "Practice Name"]
mettle = Reseller.find_by_name("mettle")
csv_string = CSV.generate(headers: headers, write_headers: true) do |csv|
Company.where(reseller: mettle).where.not(account_manager: nil).each do |c|
View currying.rb
# Create a lambda that adds its 2 params
adder = ->(x, y) { x + y }
# Curry it to pre-populate the first param with 2. This effectively turns
# add_two into ->(2, y) { 2 + y }
add_two = adder.curry[2]
# Call add_two with some other args
add_two.call(3)
# => 5
View Music 2019.md

Julia Jacklin - Crushing

One of my all time favourite albums. Nominally about a break-up. The song Don't Know How To Keep Loving You is capturing a very real fear into music and it is phenomenal.

Dry Cleaning

Fantastic band, both their EPs this year were really good

Squid - Town Centre

View Python_Primer.md

A basic exercise to help learn the basics of Python

A change dispenser

Write a programme for an automatic change dispenser. It will choose the correct coins to dispense based on the amount required. It should work like this:

  1. Prompt the user for a number between 0 & 99 (this represents the change due.)
  2. Output the correct number of 50p, 20p, 10p, 5p, 2p or 1p coins to dispense.
View pdfcolorsplit
#!/usr/bin/env python
# Python 2 and 3 compatible.
# Python program to take a pdf file, and split it into color and black
# and white part(s). Requires pdftk and one of gs and pdftoppm.
#
# Iain Murray, February 2010.
#
# Inspired by dvicoloursplit.py, Jeremy Sanders 2001, although written
# from scratch.
@neanias
neanias / BucketballRules.md
Created Feb 28, 2018
Rules for the RN game of bucketball
View BucketballRules.md

Bucketball Rules

Pitch

The pitch is usually an indoor hall. At either end of the pitch, there is a bench, but can be a gym mat depending on available equipment, upon which the bucket holder stands. There should be a small 'no-entry' zone in front of the bench that no attacker nor defender may enter. This may be signified using another mat or features of the pitch, such as a marked 'D'.

Teams

View longest_string.py
string = "abcadefzab"
longest_string = ''
current_string = ''
last_char = ''
for char in string:
if char >= last_char:
current_string += char
elif last_char > char:
View spotify.sh
running=$(pidof spotify)
if [ "$running" != "" ]; then
artist=$(playerctl metadata artist)
song=$(playerctl metadata title | cut -c 1-60)
echo -n "$artist · $song"
fi
@neanias
neanias / GoldenSyrupSponge.md
Last active Apr 4, 2017
Recipes for Golden Syrup Sponge in a slow cooker
View GoldenSyrupSponge.md
  1. Grease a bowl
  2. Make a sponge (See attached sponge mixture recipe)
  3. Pour a bunch of golden syrup into the bowl (A lot of Golden Syrup is encouraged, ask your dentist how much Golden syrup is too much and at least double it)
  4. Put the sponge mix on top
  5. Pop it in the slow cooker on high with a bit of water in the bottom
  6. Wait til it's cooked (Maybe 2 hours? "It was a long time" - Dhileas)
You can’t perform that action at this time.