Skip to content

Instantly share code, notes, and snippets.

@mgersty
mgersty / pom.xml
Created April 8, 2018 03:52
pom template with java 9 and junit5
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.gersty.learning.lambdas</groupId>
<artifactId>lambdas</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>lambdas</name>
<url>http://maven.apache.org</url>
@mgersty
mgersty / httpredirect.example.swift
Last active April 5, 2022 02:19
Swift code demonstrating the capture of a 302 redirect via delegates
import Foundation
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
class DelegateToHandle302:NSObject, URLSessionTaskDelegate {
func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) {
print(response.description)
PlaygroundPage.current.finishExecution()
}