Skip to content

Instantly share code, notes, and snippets.

View joemasilotti's full-sized avatar
📱
Helping Rails developers build iOS and Android apps with Turbo Native.

Joe Masilotti joemasilotti

📱
Helping Rails developers build iOS and Android apps with Turbo Native.
View GitHub Profile
@joemasilotti
joemasilotti / About.md
Last active February 25, 2016 22:16
NSDate Manipulation in iOS 8

This gist accompanies the blog post NSDate Manipulation Made Easy in iOS 8.

Apple quietly introduced a whole new suite of public API methods to NSCalendar in iOS 8 titled “Calendrical Calculations”. For some reason they seemed to have forgotten to include them in the public documentation on their developer site. Fortunately, digging in to the header file in Xcode reveals lots of descriptive comments about how to use these powerful new ways of interacting with NSDate objects.

//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit
import XCTest
class USTAssert: XCTestCase {
func assertExistsWithWait(wait: NSTimeInterval, evaluatedWithObject object: AnyObject) -> XCTestExpectation {
let predicate = NSPredicate(format: "exists == true", argumentArray: nil)
let result = self.expectationForPredicate(predicate, evaluatedWithObject: object, handler: nil)
waitForExpectationsWithTimeout(wait, handler: nil)
@NSExceptional
NSExceptional / UpdateXcodePluginUUIDs.m
Last active December 23, 2015 10:25
A program that adds the UUID of the current installation of Xcode (in /Applications/Xcode.app) to every Xcode plug-in's Info.plist. Does nothing if the plug-in already contains the current UUID.
//
// main.m
// UpdateXcodePluginUUIDs
//
// Created by Tanner on 12/21/15.
// Copyright © 2015 Tanner Bennett. All rights reserved.
//
#import <Foundation/Foundation.h>
protocol MyProtocol {
func setup()
}
extension MyProtocol where Self: UIViewController {
func setup() {
// Do something here
}
}
@devashish2203
devashish2203 / BaseScreen.swift
Last active December 12, 2018 01:59
Page Object Model for UITests in Swift
//
// BaseScreen.swift
//
//
// This serves as the Superclass of all other Screens that need to be created.
import Foundation
import XCTest
class BaseScreen {
@dennisschaaf
dennisschaaf / A tool for Renaming fonts to solve Multiple font-face rules issue with wkhtmltopdf.md
Last active August 17, 2021 22:42
Renaming fonts to solve Multiple @font-face rules issue with wkhtmltopdf

The Problem

wkhtmltopdf is broken and cannot render multiple fonts because of some issues around names. See wkhtmltopdf/wkhtmltopdf#2435

Workaround

  1. Pick an 8 or less char name for each font and variation e.g. HelvBold, HelvLite, TimeReg
  2. Every variation needs to be a separate font file, with all the details renamed in Font Forge using the short name determined before.
  3. Give the font files the same short name (e.g. HelvBold.ttf)
@SergLam
SergLam / UIApplication+Environment.swift
Created January 16, 2020 18:56
Swift - check iOS app environment (debug OR TestFlight build) at runtime
import UIKit
extension UIApplication {
// MARK: Public
func isRunningInTestFlightEnvironment() -> Bool {
if isSimulator() {
return false
} else {
if isAppStoreReceiptSandbox() && !hasEmbeddedMobileProvision() {
@ghiculescu
ghiculescu / lint_android.yml
Last active September 7, 2022 13:18
Github Actions CI steps for Turbo Android and Turbo iOS apps
name: ktlint
on: [pull_request]
jobs:
ktlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: ktlint