Skip to content

Instantly share code, notes, and snippets.

View textbook's full-sized avatar

Jonathan Sharpe textbook

View GitHub Profile
@textbook
textbook / test.md
Last active August 23, 2020 13:11
Pipes in tables
Escaped
|

Markup:

| Escaped |
|---|
| \| |
@textbook
textbook / evil-coders.md
Last active August 13, 2020 12:36
Let's be evil coders!
👩‍💻 Tester 👹 Evil Coder 👨‍🏫 Invigilator
Write a failing test Don’t read the exercise! No talking
Keep it simple Make the test pass Don't take large steps
Try to drive the code writer to the expected solution Try to do it in a surprising way Don't ignore bad test feedback
No more than 3 || or &&
  • Exercise: [Password Validator][1]
  • Single file test framework: [Proctor][2]
@textbook
textbook / index.html
Last active June 23, 2020 17:08
Rewriting Proofpoint/Safelinks URLs so you can see where they actually go...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>URL Extractor</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.0/css/bulma.min.css">
</head>
<body>
import { TestBed } from '@angular/core/testing';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { DemoService } from './demo.service';
fdescribe('DemoService', () => {
let service: DemoService;
let httpMock: HttpTestingController;
beforeEach(() => {
@textbook
textbook / password_creator.py
Created April 29, 2020 17:04
Simple Python password creator
from itertools import cycle
from random import choice, shuffle
from string import ascii_lowercase, ascii_uppercase, digits, punctuation
def generate_password(length: int = 20, *, use_symbols: bool = True) -> str:
"""Generate random passwords, with or without symbols.
Implementation ensures a fairly even balance of each character
class, at the cost of entropy (e.g. for a four-character password
with symbols there are only 5,191,680 possible combinations, rather
@textbook
textbook / jsharpe.theme.bash
Created June 23, 2016 09:11
Adds virtualenv to Pivotal's default (bobby) bash_it theme
#!/usr/bin/env bash
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
SCM_THEME_PROMPT_PREFIX=" |"
SCM_THEME_PROMPT_SUFFIX="${green}|"
GIT_THEME_PROMPT_DIRTY=" ${red}✗"
GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓"
GIT_THEME_PROMPT_PREFIX=" ${green}|"
GIT_THEME_PROMPT_SUFFIX="${green}|"
@textbook
textbook / README.md
Created October 2, 2019 09:04
How to create a pandas Series of ONS CPIH data
@textbook
textbook / password.py
Created September 2, 2019 17:17
Generate moderately secure passwords
#! /usr/bin/env python3
"""Generate moderately secure passwords.
Format: {word1}{number}{word2}{symbol}
By default, words are 8-10 characters long and the number is two digits.
Suggested word source (use words_alpha.txt):
https://github.com/dwyl/english-words

CYF Conference 2019

Code Retreat

Overview

  • Each iteration will be 35 minutes of coding, followed by a 15 minute retro, followed by a 10 minute break.
  • We will be working in pairs and using test-driven development (TDD). Pairs switch after each iteration.
  • After each iteration, we will start from scratch - delete your code! The goal is the practice, not the code.