Skip to content

Instantly share code, notes, and snippets.

View gtranchedone's full-sized avatar

Gianluca Tranchedone gtranchedone

View GitHub Profile
@gtranchedone
gtranchedone / xcode_tags_highlight.sh
Created November 7, 2016 13:01
Script to highlight comments marking TODOs, FIXMEs, WARNINGs and ERRORs in Xcode
TAGS="\/\/.*TODO:|\/\/.*FIXME:|\/\/.*WARNING:|\/\/.*ERROR:"
TARGET_FOLDER="${SRCROOT}"
echo "searching ${TARGET_FOLDER} for ${TAGS}"
find -E "${TARGET_FOLDER}" -regex ".*\.(swift|m|h)" ! -path "${PODS_ROOT}/**/*" -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@gtranchedone
gtranchedone / App Templates For Vapor.md
Last active January 28, 2017 03:32
Vapor Classes Templates

Classes that I use as templates for Server Side Swift using Vapor.

@gtranchedone
gtranchedone / VaporRoutes.swift
Created November 26, 2016 15:22
Vapor Routes Command Helper
import Console
import Routing
import HTTP
class FakeRouter: RouteBuilder {
public typealias Host = String
public typealias Method = String
public typealias Output = HTTP.Responder
private let console: Terminal
@gtranchedone
gtranchedone / Auto Layout Example: Manual Layout.swift
Last active January 7, 2017 10:35
Auto Layout Example: Manual Layout
// A view containing stacked title and message labels
// The entire layout is manually calculated every time the view has to be rendered or it's requested to re-layout
class SomeView: UIView {
let titleLabel = UILabel(frame: .zero)
let messageLabel = UILabel(frame: .zero)
// ...other subviews
@gtranchedone
gtranchedone / Auto Layout Example: Springs and Struts.swift
Created January 7, 2017 10:35
Auto Layout Example: Springs and Structs
// A view containing stacked title and message labels
// The labels have flexible width that changes accordingly to this view's size changes
class SomeView: UIView {
let titleLabel: UILabel
let messageLabel: UILabel
// ...other subviews
@gtranchedone
gtranchedone / LinuxMain.swift
Last active February 20, 2017 17:53
Testing Server Side Swift Apps - LinuxMain
import XCTest
@testable import AppTests
XCTMain([
testCase(PostsControllerTests.allTests),
])
@gtranchedone
gtranchedone / PostsController.swift
Created February 20, 2017 17:53
Testing Server Side Swift Apps - PostsControllerTests (Basic)
import XCTest
@testable import App
class PostsControllerTests: XCTestCase {
func testExample() {
XCTAssertTrue(true)
}
}
@gtranchedone
gtranchedone / Package.swift
Created February 20, 2017 17:59
Testing Server Side Swift Apps - Package Manifesto
import PackageDescription
let package = Package(
name: "VaporApp",
targets: [
Target(name: "Executable", dependencies: ["App"])
],
dependencies: [
.Package(url: "https://github.com/vapor/vapor.git", majorVersion: 1, minor: 5)
],
@gtranchedone
gtranchedone / VaporRespond.swift
Created May 30, 2017 16:13
Respond to different requests in Vapor
public func respond(to request: Request, with responses: [ContentType : ResponseRepresentable]) throws -> ResponseRepresentable {
let contentType: ContentType
let _ = request.accept.prefers("html")
if let header = request.accept.first {
var requestedContentType = ContentType.from(string: header.mediaType)
if requestedContentType == .any {
if let requestContentType = request.contentType {
requestedContentType = ContentType.from(string: requestContentType)
}
else {
@gtranchedone
gtranchedone / UI Testing.md
Last active March 5, 2018 15:20
Guidelines for UI Testing

What is UI Testing?

In software engineering, graphical user interface testing is the process of testing a product's graphical user interface to ensure it meets its specifications. This is normally done through the use of a variety of test cases.

-- Wikipedia

UI Testing (also know as End-to-End Testing, or sometimes Integration Testing) helps with two aspects of software development:

  • Regression Testing: to ensure that all possible user journeys - especially the edge cases, or for rarely visited screens - consistently funcion correctly across releases.
  • New features development: to help determine 1. the minimum amount of work to be done to implement the feature, 2. that the new feature functions correctly, 3. helps ensuring the app is more accessible for people with disabilities. Moreover, done during development, UI Testing ensures immediate regression testing exposure.