Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View taybenlor's full-sized avatar

Ben Taylor taybenlor

View GitHub Profile
@taybenlor
taybenlor / background.js
Created March 27, 2023 08:15
A chrome extension for Cypress that forces the browser to emulate focus.
/**
* Force Focus
*
* This extension forces Emulation.setFocusEmulationEnabled
* which allows tests that are dependent on focus to work when
* the browser is not focused or when it is in headless mode
*/
chrome.tabs.onUpdated.addListener(function (tabId, info) {
console.log("Force focus opened new tab", tabId, info);
@taybenlor
taybenlor / cat.rs
Last active September 12, 2022 10:36
print content in each args file to STDOUT
use std::{env, fs};
fn main() {
for filename in env::args().skip(1) {
let content = fs::read_to_string(filename).expect("unable to read file");
print!("{}", content);
}
}
@taybenlor
taybenlor / write.rs
Created September 12, 2022 10:30
This program writes whatever you type into STDIN to the file specified in arg1.
use std::io::Read;
use std::{env, fs, io};
fn main() {
let filename = env::args().nth(1).expect("no filename provided");
let stdin = io::stdin();
let mut buf = String::new();
stdin
.lock()
@taybenlor
taybenlor / house.py
Created July 18, 2021 07:32
A way to do text adventures using modules.
"""
Each module can import the player module to get their name and their items.
Here we add boots to their items if they write "pickup boots".
"""
import main
import player
def enter():
#include <Mouse.h>
#define enc_dt 2
#define enc_clk 3
int responseDelay = 2; // response delay of the mouse, in ms
void setup() {
@taybenlor
taybenlor / NicerDates.swift
Created July 20, 2015 08:28
Make dates nicer, very quick hack
//
// NicerDates.swift
//
// Created by Ben Taylor on 20/07/2015.
//
import Foundation
extension Int {
RAC(self, property) = RACObserve(self.model, property);
@taybenlor
taybenlor / Form Letter.md
Last active April 23, 2017 08:35
Form letter that I email to companies offering unpaid internships.

Subject: Unpaid Internships & Fair Work

Hi there,

I'm Ben Taylor, I don't represent anyone or anything, I'm simply a concerned Australian. Our country has long been known as a paradise for the working class. We give fair holidays and fair pay. We're a country that doesn't tip because we know the waitstaff are earning enough to support themselves.

I'm emailing you because your company is offering an unpaid internship. Under Australian law it's illegal to have an employee that works for free. In many cases unpaid internships are illegal.

It's absolutely in your right to offer an internship, you can pay them minimum wage if you like, but not paying is exploitative and discriminatory. Should a young person who is independent be forced to take a second job or live under severe financial stress just to get a chance in an industry? What about those who can't afford to do even that?

@taybenlor
taybenlor / CustomCollectionFlowLayout.h
Last active January 1, 2016 08:59 — forked from toblerpwn/CustomCollectionFlowLayout.h
Adds support for sections with no header.
//
// CustomCollectionFlowLayout.h
// evilapples
//
// http://stackoverflow.com/questions/13511733/how-to-make-supplementary-view-float-in-uicollectionview-as-section-headers-do-i
//
//
#import <UIKit/UIKit.h>

Autolayout lessons: