Skip to content

Instantly share code, notes, and snippets.

@almassapargali
almassapargali / InstagramActivity.swift
Created January 11, 2018 18:54
UIActivity for Instagram image sharing
import Foundation
import UIKit
private let InstagramAppURL = URL(string: "instagram://app")!
class InstagramActivity: UIActivity, UIDocumentInteractionControllerDelegate {
override class var activityCategory: UIActivityCategory { return .share }
override var activityType: UIActivityType? { return UIActivityType("postToInstagram") }
override var activityTitle: String? { return "Instagram" }
override var activityImage: UIImage? { return #imageLiteral(resourceName: "instagram_activity") }
@almassapargali
almassapargali / gist:068aeccce27b205f527a
Created February 11, 2015 17:32
zipWith for ReactiveCocoa
/// Zips elements of two signals into pairs. The elements of any Nth pair
/// are the Nth elements of the two input signals.
public func zipWith<T, U, E>(otherSignal: Signal<U, E>)(signal: Signal<T, E>) -> Signal<(T, U), E> {
return Signal { observer in
let lock = NSRecursiveLock()
lock.name = "org.reactivecocoa.ReactiveCocoa.zipWith"
var signalValues: [T] = []
var otherValues: [U] = []
@almassapargali
almassapargali / DefaultParamsSerializer.m
Created July 3, 2014 23:13
add parameters too all requests
#import "DefaultParamsSerializer.h"
@implementation DefaultParamsSerializer
- (NSMutableURLRequest *)requestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(id)parameters error:(NSError *__autoreleasing *)error
{
if (parameters) {
if ([parameters isKindOfClass:[NSDictionary class]]) {
NSMutableDictionary *mParams = [parameters mutableCopy];
mParams[@"key"] = @"value";