Skip to content

Instantly share code, notes, and snippets.

Mattt mattt

Block or report user

Report or block mattt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View BoundedSequence.swift
public struct BoundedSequence<Base>: Sequence, IteratorProtocol where Base: Sequence {
public struct Boundary: Equatable {
public let isStart: Bool
public let isEnd: Bool
private var _iterator: Base.Iterator
private var _previous: Base.Element?
private var _current: Base.Element?
private var _next: Base.Element?
View zalgo.swift
func zalgo(_ string: String, intensity: Int = 5) -> String {
let combiningDiacriticMarks = 0x0300...0x036f
let latinAlphabetUppercase = 0x0041...0x005a
let latinAlphabetLowercase = 0x0061...0x007a
var output: [UnicodeScalar] = []
for scalar in string.unicodeScalars {
guard (latinAlphabetUppercase).contains(numericCast(scalar.value)) ||
mattt / Sieve.swift
Last active Jan 27, 2019
Sieve of Eratosthenes with Accelerate
View Sieve.swift
// Calculate prime numbers in a given range
// using Sieve of Eratosthenes
import Accelerate
var primes: [Int] = []
let range = 0...999
var numbers =
mattt / crash.log
Created Jun 12, 2018
Crash log resulting from use of CRF algorithm when training text classifier in Xcode 10.0 beta (10L176w)
View crash.log
0 swift 0x00000001109fac5a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x00000001109fa066 SignalHandler(int) + 966
2 libsystem_platform.dylib 0x00007fff65e29d9a _sigtramp + 26
3 libsystem_malloc.dylib 0x00007fff65e09ed4 tiny_malloc_should_clear + 289
4 CoreNLP 0x00007fff4d7948eb invocation function for block in CoreNLP::NLModelTrainer::readSample(__CFString const*, std::__1::vector<CFRange, std::__1::allocator<CFRange> > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, CoreNLP::NLTrainerDataType) + 1010
5 CoreNLP 0x00007fff4d751fd7 CoreNLP::CompositeTagger::enumerateTokens(NLTokenizerUnit, CFRange, unsigned long, void (NLToken, bool*) block_pointer) + 567
6 CoreNLP 0x00007fff4d7944c0 CoreNLP::NLModelTrainer::readSample(__CFString
mattt /
Created May 27, 2015
Rocket: a hybrid approach to real-time cloud applications

This document was originally posted on 8/1/2013.

Rocket is a technique for building real-time functionality on top of REST web services that leverages web standards like [Server-Sent Events][SSE] and [JSON Patch][RFC6902]. Most importantly, it fits comfortably with how you're already building applications.

A Tale of Two Paradigms

Just as light can act as both a particle and a wave, so information can be thought as both a document and a stream.

Each approach has its particular strengths and weaknesses:

View Regex.swift
struct Regex {
let pattern: String
let options: NSRegularExpressionOptions!
private var matcher: NSRegularExpression {
return NSRegularExpression(pattern: self.pattern, options: self.options, error: nil)
init(pattern: String, options: NSRegularExpressionOptions = nil) {
self.pattern = pattern
View CoreGraphics.swift
import CoreGraphics
infix operator |> { precedence 50 associativity left }
// MARK: CGPoint
func +(lhs: CGPoint, rhs: CGPoint) -> CGPoint {
return CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
View Calendar.swift
protocol Calendar {
typealias Unit: BidirectionalIndexType
typealias Era: Unit
typealias Year: Unit
typealias Month: Unit
typealias Week: Unit
typealias Day: Unit
typealias Weekday: Unit
typealias Hour: Unit
View URL.swift
struct URL {
var scheme: String?
var user: String?
var password: String?
var host: String?
var port: Int?
var path: String?
var query: String?
var fragment: String?
View Complex.swift
struct Complex<T: FloatLiteralConvertible> {
var real: T
var imaginary: T
func +(lhs: Complex<Double>, rhs: Complex<Double>) -> Complex<Double> {
return Complex<Double>(real: lhs.real + rhs.real, imaginary: lhs.imaginary + rhs.imaginary)
You can’t perform that action at this time.