Skip to content

Instantly share code, notes, and snippets.


Jason Brennan jbrennan

View GitHub Profile
View StringScanner.swift
import Foundation
/// `StringScanner` is a fast scanner for Strings and String-like objects.
/// It's used to extract structured bits from unstructured strings, while
/// avoiding making extra copies of string bits until absolutely necessary.
/// You can build Scanners over Substrings, allowing you to scan
/// parts of strings and use smaller, more specialized scanners to extract bits
/// of that String without needing to reuse another scanner.
public struct StringScanner<Input: StringProtocol> {
let input: Input
bijij / viewimage.user.js
Last active Feb 8, 2021
Userscript version of the View Image chrome extension
View viewimage.user.js
// ==UserScript==
// @name View Image
// @namespace
// @version 3.3.0
// @description This userscript re-implements the "View Image" and "Search by image" buttons into google images.
// @author Joshua B
// @run-at document-end
// @include http*://*.google.tld/search*tbm=isch*
// @include http*://*.google.tld/imgres*
// @updateURL
View ArchiveCurrent.applescript
tell application "Notes"
move front note to folder "Archive"
end tell
forresto / dynamicland-vneck-tshirt.lua
Last active Aug 30, 2018
first shot at dynamicland #softfab
View dynamicland-vneck-tshirt.lua
-- Shirt (#softfab)
Claim (you) has state "waist" with initial value (30).
Claim (you) has state "arm" with initial value (5).
Claim (you) has state "armaround" with initial value (10).
Claim (you) has state "side" with initial value (20).
Claim (you) has state "neck" with initial value (15).
When (you) contains dots /dots/,
(you) has width /width/:
View NilError.swift
public struct NilError: Error, CustomStringConvertible {
let file: String
let line: Int
public init(file: String = #file, line: Int = #line) {
self.file = file
self.line = line
View gist:8de90a6ebe9f08933bc94c6ab18d1bfd
A Visual Introduction to Machine Learning
UC Berkeley CS188 Intro to AI -- Course Materials
Eyeo 2016 – Gene Kogan
khanlou / MD5StringTest.swift
Last active Apr 12, 2019
MD5 and SHA1 on String in Swift 3
View MD5StringTest.swift
import XCTest
@testable import <#project#>
class StringMD5Test: XCTestCase {
func testMD5() {
let string = "soroush khanlou"
XCTAssertEqual(string.md5, "954d741d14b14002d1ba88f600eee635")
trouttdev /
Last active Nov 16, 2016
How to add CC and BCC fields to SparkPost API

How to send a SparkPost email via API with a CC and BCC

Originally I found this which only vaguely pointed me in the right direction, so I thought I'd create a gist of what ended up working for me.


To add a CC address, you have to two two things

  1. Add the address to your recipeints array, and set the header_to value to an address in the to field. So if you're sending the email to and CCing it to, the header_to for will need to be set to
  2. Add the email to the CC headers option in content object. If you have multiple emails, these should be comma separated.
View swift-self-build
# Faster toolchain build: skips as much as possible.
# To use this toolchain from the command line:"
# export TOOLCHAINS=$(whoami)
# we build to the same prefix every time (instead of building
# to a versioned prefix) because every time the prefix changes
# *everything* rebuilds.
doersino /
Last active Oct 28, 2017
Simple way of backing up one or multiple Tumblr blogs to date-prefixed folders; downloads and removes required software (except Python) automatically.
# BLOGS is a space-separated list of the blogs you want to backup. You can omit
# the "" part if you want.
# OUT is the directory where the backups will be stored. For each blog, a date-
# prefixed subdirectory will be created here.