Skip to content

Instantly share code, notes, and snippets.

View gtranchedone's full-sized avatar

Gianluca Tranchedone gtranchedone

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gtranchedone on github.
  • I am gtranchedone (https://keybase.io/gtranchedone) on keybase.
  • I have a public key ASAcsJeDWnxlG38poeOC7M06w9o_fObAWMB5icYKqj-IBgo

To claim this, I am signing this object:

@gtranchedone
gtranchedone / jwtRS256.sh
Created July 29, 2018 15:39 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@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.
@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 / 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 / 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 / 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 / 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 / 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 / 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