Skip to content

Instantly share code, notes, and snippets.

adam-zethraeus / copy_url_to_selection_bookmarklet.js
Last active Sep 10, 2020
a bookmarklet to copy a url to the current page, with the current selection highlighted. (Chrome only. Because other browser care about timing attacks more than your Google search result experience.)
View copy_url_to_selection_bookmarklet.js
let tempInput = document.createElement("input");
tempInput.value = window.location.href + `#:~:text=${window.getSelection().toString()}`;
View BetterOnboardingManagerTestsExcerpt.swift
func testPasswordCanNotContainUsername() {
let (didPass, issue) = OnboardingManager.validatePassword(password: "ValidUsername$123",
username: "ValidUsername",
email: "",
phoneNumber: "+11235554321")
XCTAssertEqual(issue, PasswordIssue.containsUsername)
View BadOnboardingManagerTestExcerpt.swift
func test_PasswordCanNotContainUsername() {
let mockPasswordCollectorLauncher = MockPasswordCollectorLauncher()
let mockListener = MockOnboardingManagerListener()
let onboardingManager = BadOnboardingManager(passwordCollectorLauncher: mockPasswordCollectorLauncher)
onboardingManager.listener = mockListener
// TODO: assert the username collector launches now.
onboardingManager.usernameCollectorReturned(username: "ValidUsername")
View BadOnboardingManagerExcerpt.swift
private func validatePassword() {
self.passwordIsValid = false
self.passwordIssue = nil
guard let username = self.username,
let email =,
let phoneNumber = self.phoneNumber,
let password = self.password
else {
adam-zethraeus / gist:4583560
Created Jan 21, 2013
Stick it in your .bash_profile on your mac to get QuickLook from the terminal.
View gist:4583560
alias ql='qlmanage -p "$@" > /dev/null'
You can’t perform that action at this time.