Skip to content

Instantly share code, notes, and snippets.

Matthew Crenshaw sgtsquiggs

Block or report user

Report or block sgtsquiggs

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 Logging.swift
import CocoaLumberjack
extension DDLogFlag {
public var level: String {
switch self {
case DDLogFlag.error: return "❤️ ERROR"
case DDLogFlag.warning: return "💛 WARNING"
case DDLogFlag.info: return "💙 INFO"
case DDLogFlag.debug: return "💚 DEBUG"
case DDLogFlag.verbose: return "💜 VERBOSE"
View crossthestreams.swift
import RxSwift
extension PrimitiveSequence where TraitType == SingleTrait {
public func asMaybe() -> PrimitiveSequence<MaybeTrait, Element> {
return self.asObservable().asMaybe()
}
public func asCompletable() -> PrimitiveSequence<CompletableTrait, Never> {
return self.asObservable().flatMap { _ in Observable<Never>.empty() }.asCompletable()
@sgtsquiggs
sgtsquiggs / Observable+BindCollection.swift
Last active Jul 12, 2018
Bind an observable to a collection of observers at once.
View Observable+BindCollection.swift
import RxSwift
extension ObservableType {
func bind<O>(to observers: [O]) -> Disposable where O: ObserverType, Self.E == O.E {
let shared = self.share()
let disposables = observers.map(shared.bind(to:))
return CompositeDisposable(disposables: disposables)
}
}
@sgtsquiggs
sgtsquiggs / random_investigator
Last active Mar 19, 2019
Arkham Horror Investigator Randomizer
View random_investigator
#!/usr/bin/env python
import sys
import getopt
import random
def main(argv):
investigator_type = 'all'
full_team = False
pick_two = False
@sgtsquiggs
sgtsquiggs / UIImage+PDFDocument.swift
Created Nov 2, 2017
UIImage extension for PDF documents
View UIImage+PDFDocument.swift
import UIKit
extension UIImage {
convenience init?(pdfDocument: CGPDFDocument, pageNumber: Int = 1) {
guard let page = pdfDocument.page(at: pageNumber) else { return nil }
let size = page.getBoxRect(.mediaBox).size
UIGraphicsBeginImageContextWithOptions(size, true, UIScreen.main.scale)
let context = UIGraphicsGetCurrentContext()!
context.saveGState()
@sgtsquiggs
sgtsquiggs / download_devices.rb
Created Dec 13, 2016
Fastlane action to download device UDIDs for the current team
View download_devices.rb
module Fastlane
module Actions
class DownloadDevicesAction < Action
def self.run(params)
require 'spaceship'
ship = Spaceship::Portal.login(ENV['DELIVER_USER'], ENV['DELIVER_PASSWORD'])
ship.team_id = CredentialsManager::AppfileConfig.try_fetch_value(:team_id)
devices = ship.devices
@sgtsquiggs
sgtsquiggs / new_relic_system_monitor.ebextensions.config
Last active Jul 29, 2016
New Relic Server Monitoring on Elastic Beanstalk
View new_relic_system_monitor.ebextensions.config
# installs and configures New Relic System Monitoring agent
# https://crondev.com/new-relic-server-monitoring-on-elastic-beanstalk/
# requires `AmazonEC2ReadOnlyAccess` policy to get eb environment name
#
files:
"/opt/elasticbeanstalk/get-eb-env-name.py":
mode: "000755"
owner: root
group: root
content: |
View game.py
import random
def draw_board(board):
print(' | |')
print(' %s | %s | %s' % (board[1], board[2], board[3]))
print(' | |')
print('---+---+---')
print(' | |')
print(' %s | %s | %s' % (board[4], board[5], board[6]))
View showmethefonts.m
#ifdef SHOW_ME_THE_FONTS
for (NSString *familyName in [UIFont familyNames]){
NSLog(@"Family name: %@", familyName);
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"--Font name: %@", fontName);
}
}
#endif
@sgtsquiggs
sgtsquiggs / keybase.md
Created Feb 24, 2015
Keybase.io Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am sgtsquiggs on github.
  • I am sgtsquiggs (https://keybase.io/sgtsquiggs) on keybase.
  • I have a public key whose fingerprint is C5E6 CDA3 BB97 829F AAA1 6E68 4712 D21A 0B0E A994

To claim this, I am signing this object:

You can’t perform that action at this time.