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"`
#
@angelolloqui
angelolloqui / UIImage+H568.m
Last active October 6, 2022 16:35
iPhone5 UIImage method swizzling to load -568h images
//
// UIImage+H568.m
//
// Created by Angel Garcia on 9/28/12.
// Copyright (c) 2012 angelolloqui.com. All rights reserved.
//
#import <objc/runtime.h>
@implementation UIImage (H568)
@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"
}
//: Playground - noun: a place where people can play
import UIKit
////////////
// Nested protocols not compiling
////////////
protocol A {
protocol B {}
}
@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 / gist:3872250
Created October 11, 2012 13:24
Activate Accesibility
NSString *appSupportLocation = @"/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport";
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
NSString *simulatorRoot = [environment objectForKey:@"IPHONE_SIMULATOR_ROOT"];
if (simulatorRoot) {
appSupportLocation = [simulatorRoot stringByAppendingString:appSupportLocation];
}
void *appSupportLibrary = dlopen([appSupportLocation fileSystemRepresentation], RTLD_LAZY);
@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 / RKRequest+CacheControl.h
Created August 15, 2012 14:52
RestKit addition to add a new cache policy that checks the Cache-Control HTTP header
//
// RKRequest+CacheControl.h
//
// Created by Angel on 8/10/12.
// Copyright (c) 2012 Xaton. All rights reserved.
//
#import "RKRequest.h"