Skip to content

Instantly share code, notes, and snippets.

Avatar
📗
Building railsdevs in public.

Joe Masilotti joemasilotti

📗
Building railsdevs in public.
View GitHub Profile
@joemasilotti
joemasilotti / rm_conflicted.sh
Last active Aug 29, 2015
Remove Dropbox Conflicted Files
View rm_conflicted.sh
find . -type f -name "* conflicted *" -exec rm -f {} \;
@joemasilotti
joemasilotti / remove_tag
Created May 11, 2014
Git: Remove remote tag
View remove_tag
git tag -d 12345
git push origin :refs/tags/12345
View .gitconfig
[alias]
yesterday = log --graph --decorate --oneline --after='yesterday' --until='today midnight’
@joemasilotti
joemasilotti / ABVFormatter.h
Last active Aug 29, 2015
How to format ABV% in Objective-C.
View ABVFormatter.h
#import <Foundation/Foundation.h>
@interface ABVFormatter : NSObject
- (NSString *)formattedABV:(NSNumber *)abv;
@end
@joemasilotti
joemasilotti / Backgrounder.h
Created Jul 7, 2015
Completion Blocks in Cedar
View Backgrounder.h
typedef void(^BackgroundCompletion)();
@interface Backgrounder : NSObject
- (void)executeInBackground:(BackgroundCompletion)completion;
@end
@joemasilotti
joemasilotti / WKUserContentController+Spec.h
Last active Sep 2, 2015
WKUserContentController Swizzling (breaks in Xcode 7)
View WKUserContentController+Spec.h
#import <WebKit/WebKit.h>
@interface WKUserContentController (Spec)
- (NSDictionary *)userScriptHandlers;
@end
@joemasilotti
joemasilotti / UITest.swift
Created Sep 17, 2015
How to assert if a view is off screen
View UITest.swift
import XCTest
class UITests: XCTestCase {
let app = XCUIApplication()
override func setUp() {
super.setUp()
continueAfterFailure = false
app.launch()
}
@joemasilotti
joemasilotti / GuardFormatting.swift
Last active Nov 17, 2015
Which Swift guard formatting do you prefer?
View GuardFormatting.swift
//: Playground - noun: a place where people can play
enum Error: ErrorType {
case ParsingError
}
struct Person {
let name: String
let age: Int
@joemasilotti
joemasilotti / MyPlayground.swift
Last active Dec 14, 2015
Swift Array to Dictionary
View MyPlayground.swift
//: Playground - noun: a place where people can play
struct Option {
var id: UInt
var name: String
}
func combine(options: [Option]) -> [UInt: String] {
var combinedOptions = [UInt: String]()
for option in options {
@joemasilotti
joemasilotti / UITests.swift
Created Jan 5, 2016
Stubbing out repeating animations in UI Testing
View UITests.swift
import XCTest
class TestCase: XCTestCase {
let app = XCUIApplication()
override func setUp() {
super.setUp()
continueAfterFailure = false
app.launchArguments = ["UI-Testing"]