Skip to content

Instantly share code, notes, and snippets.

@angelolloqui
angelolloqui / format_github_release_to_slack.py
Last active September 14, 2023 12:22
Github API offers a automated release notes generation. This script parses the output of that call and transforms it to a compatible Slack format
# This script transforms a GitHub release json into a Slack message. It takes the content from the body and applies several transformations to make it look better in Slack.
# Usage:
# python3 format_github_release_to_slack.py [-pre-text <pre-text>] [-channel <channel>]
# -pre-text <pre-text>: Optional - text to be added as a first message. It accepts Slack markdown format.
# -channel <channel>: Optional - name of channel, for example #general
#
# Example using a previous message as input:
# `cat github_release.json | python3 scripts/format_github_release_to_slack.py "New Android release 5.74.0-RC1 available"`
#
//: Playground - noun: a place where people can play
import UIKit
////////////
// Nested protocols not compiling
////////////
protocol A {
protocol B {}
}
@angelolloqui
angelolloqui / SSLPinningValidator.swift
Created August 18, 2016 08:50
SSL pinning validator with implementation for the Subject public key info (SPKI), based on the one at https://github.com/datatheorem/TrustKit
//
// SSLPinningValidator.swift
//
// Created by Angel Garcia on 17/08/16.
//
import Foundation
import CommonCrypto
protocol SSLPinningValidator {
@angelolloqui
angelolloqui / NSObjectKVOExtentions.swift
Last active March 7, 2019 20:41
Swift KVO extension to provide track on addObserver and removeObserver methods, avoiding the annoying crashes due to observers not register
// Created by Angel Garcia on 06/05/16.
import Foundation
extension NSObject {
private struct AssociatedKeys {
static var safeObservers = "safeObservers"
}
@angelolloqui
angelolloqui / AGCommand.h
Last active April 26, 2016 06:17
Example combining generic DataSources with the Chain Of Responsility command with custom command objects. DataSource can fully configure any table or collection view, and fires commands by calling the factory method on click. Code is taken from a real project where advance features have been implemented like customizable chain, cell animations, …
typedef enum {
AGCommandPriorityLow = -10,
AGCommandPriorityDefault = 0,
AGCommandPriorityHigh = 10
} AGCommandPriority;
@interface AGCommand : NSObject
@property(nonatomic, weak) NSObject *firingObject;
@property(nonatomic, readonly) SEL action;
@angelolloqui
angelolloqui / PayPalMPL.podspec.json
Last active August 29, 2015 14:03
PayPalMPL pod pointing to specific commit. Tired of asking PayPal to not remove old versions as CocoaPods breaks every time they make a new release.
{
"name": "PayPalMPL",
"version": "2.1.3",
"summary": "PayPal MPL Payment library for iOS.",
"homepage": "https://www.paypal.com",
"license": {
"type": "Copyright",
"text": " Copyright (c) 2014 PayPal\n"
},
"authors": "PayPal",
@angelolloqui
angelolloqui / UIView+Hack.m
Last active August 29, 2015 13:56
Hack into Pixate to set the cornerRadius into the layer
#import <objc/runtime.h>
@protocol Custom_PXBoxModel <NSObject>
- (BOOL)hasCornerRadius;
- (CGSize)radiusTopLeft;
- (CGSize)radiusTopRight;
- (CGSize)radiusBottomRight;
- (CGSize)radiusBottomLeft;
@end
@angelolloqui
angelolloqui / AGCommand.h
Last active May 15, 2018 10:33
Advanced NSObject additions to handle commands
@interface AGCommand : NSObject
@property(nonatomic, weak) UIResponder *firingObject;
@property(nonatomic, readonly) SEL action;
+ (instancetype)command;
@end
@angelolloqui
angelolloqui / AGCommand.h
Last active December 10, 2016 21:33
Basic UIResponder additions to handle commands
@interface AGCommand : NSObject
@property(nonatomic, weak) UIResponder *firingObject;
@property(nonatomic, readonly) SEL action;
+ (instancetype)command;
@end
@angelolloqui
angelolloqui / MOFAddress.h
Last active January 4, 2016 19:09
Simple example of using a Transformable object as part of a CoreData model. Use it only for very simple objects, with no relations.
@interface MOFAddress : NSObject <NSCoding>
@property (nonatomic, strong) NSString *city;
@property (nonatomic, strong) NSString *number;
@property (nonatomic, strong) NSString *street;
@property (nonatomic, strong) NSString *postCode;
@property (nonatomic, strong) NSString *location;
@end