Skip to content

Instantly share code, notes, and snippets.

@flashfabrixx
flashfabrixx / style.css
Created December 14, 2018 08:42
CSS für iFrame
body,
.toolbar {
background: transparent;
}
.toolbar .cart {
background: #f8f9fa;
}
.toolbar-counter {
@flashfabrixx
flashfabrixx / CouponViewController_new.m
Last active April 26, 2017 15:12
Version 1.9.22 to Version 1.10.0
- (void)viewDidLoad {
[super viewDidLoad];
// This object will generate HTML requests for our WebView, that we will use to show the coupon
// details and fire the redemption
id theDelegate = [[UIApplication sharedApplication] delegate];
self.requestFactory = [[theDelegate coupiesManager] requestFactoryForType:kCOUPIESRequestFactoryTypeHTML];
// Load the details of the coupon and count the click
[webView loadRequest:[self.requestFactory requestForCouponWithId:(NSUInteger)self.coupon.couponId]];
@flashfabrixx
flashfabrixx / AppDelegate.m
Created March 15, 2017 13:20
Zendesk Push Configuration
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
// ...
// Convert device token from NSData to NSString
NSMutableString* pushTokenString = [NSMutableString stringWithString:[self.description uppercaseString]];
[pushTokenString replaceOccurrencesOfString:@"<" withString:@"" options:0 range:NSMakeRange(0, pushTokenString.length)];
[pushTokenString replaceOccurrencesOfString:@">" withString:@"" options:0 range:NSMakeRange(0, pushTokenString.length)];
[pushTokenString replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, pushTokenString.length)];
@flashfabrixx
flashfabrixx / client_setup1.jpg
Created August 1, 2016 15:14 — forked from anhar/setting_up_ios_universal_links.md
Setting up iOS Universal Links
client_setup1.jpg
@flashfabrixx
flashfabrixx / mongodb.rb
Created July 26, 2014 08:15
Homebrew script for MongoDB on Mac OS X 10.10
require "formula"
class Mongodb < Formula
homepage "http://www.mongodb.org/"
url "http://downloads.mongodb.org/src/mongodb-src-r2.6.3.tar.gz"
sha1 "226ab45e3a2e4d4a749271f1bce393ea8358d3dd"
bottle do
sha1 "d573717ca7c67455680a6823de210c940faf9ac6" => :mavericks
sha1 "f7d2a0711e3ac09fd61bcb243360c1a07fb83233" => :mountain_lion
@flashfabrixx
flashfabrixx / Days since Reference Date
Created May 8, 2014 09:44
Method returns a string containing the number of days since a given reference date
- (NSString *)daysSinceDate:(NSDate *)referenceDate
{
NSDate *today = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSCalendarUnit units = NSYearCalendarUnit | NSMonthCalendarUnit | NSWeekCalendarUnit | NSWeekdayCalendarUnit | NSDayCalendarUnit;
NSDateComponents *components = [gregorian components:units fromDate:referenceDate toDate:today options:0];
NSInteger days = [components day];
NSInteger years = [components year];
@flashfabrixx
flashfabrixx / authHeader AFNetworking
Created June 20, 2013 16:01
Setting authorization header in AFNetworking with special characters
// Override the following method in AFHTTPClient.m
- (void)setAuthorizationHeaderWithUsername:(NSString *)username password:(NSString *)password {
CFHTTPMessageRef dummyRequest = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)@"GET", (__bridge CFURLRef)[NSURL URLWithString:@"http://yourdummyurl.com"], kCFHTTPVersion1_1);
if (dummyRequest) {
CFHTTPMessageAddAuthentication(dummyRequest, nil, (__bridge CFStringRef)username, (__bridge CFStringRef)password,kCFHTTPAuthenticationSchemeBasic, FALSE);
CFStringRef authorizationString = CFHTTPMessageCopyHeaderFieldValue(dummyRequest, CFSTR("Authorization"));
if (authorizationString) {
NSLog(@"Authorization: %@", authorizationString);
[self setDefaultHeader:@"Authorization" value:[NSString stringWithFormat:@"%@", authorizationString]];