Skip to content

Instantly share code, notes, and snippets.

View messeb's full-sized avatar
:octocat:
Commiting

Sebastian Messingfeld messeb

:octocat:
Commiting
View GitHub Profile
@messeb
messeb / Makefile
Last active November 26, 2022 13:21
Let's Encrypt certification creation on macOS
## Create Let's Encrypt certificate for DOMAIN and www subdomain of DOMAIN.
DOMAIN=example.com
EMAIL=noreply@example.com
.PHONY: default install generate
default: install
install:
@messeb
messeb / URLResponse+HTTP.swift
Created December 5, 2017 21:00
URLResponse as HTTPURLResponse and check if call has status code 2xx
extension URLResponse {
/// Returns casted `HTTPURLResponse`
var http: HTTPURLResponse? {
return self as? HTTPURLResponse
}
}
extension HTTPURLResponse {
/// Returns `true` if `statusCode` is in range 200...299.
/// Otherwise `false`.
### Keybase proof
I hereby claim:
* I am messeb on github.
* I am messeb (https://keybase.io/messeb) on keybase.
* I have a public key ASBdLKgcqx4kpDUor-OwoWOn0gG3sHXSQNxwtsDREhckpwo
To claim this, I am signing this object:
@messeb
messeb / Test segue between two UIViewControllers
Created January 18, 2014 19:11
UIViewControllers should also be tested. But tests for the connection of two controllers via Storyboard segues are often missing. Here a example how you can test segue from one to another UIViewController via -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender with OCMock.
UIViewController *vc = // ViewController
id mockVC = [OCMockObject partialMockForObject:vc];
UIButton *button = // Button on view of ViewController
UIStoryboardSegue *storyBoardSegue = [OCMArg checkWithBlock:^BOOL(id obj){
UIStoryboardSegue *segue = obj;
UIViewController *src = segue.sourceViewController;
UIViewController *dst = segue.destinationViewController;
NSString *idtf = segue.identifier;