Skip to content

Instantly share code, notes, and snippets.

View m1entus's full-sized avatar

Michał Zaborowski m1entus

View GitHub Profile

Question

How to implement a UITableView with a separator line like this:

doubly separator line

Usually, you can only set the separatorLine property of a UITableView with to single line or single line etched. Sometimes, it is not enough. So, how to implement a separator line like this?

Answer

#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@m1entus
m1entus / build-ffmpeg.sh
Last active June 22, 2024 04:06
Installing ffmpeg ios libraries armv7, armv7s, i386
#!/bin/bash
###########################################################################
# Choose your ffmpeg version and your currently-installed iOS SDK version:
#
VERSION="2.0.2"
SDKVERSION="7.0"
ARCHS="armv7 armv7s i386"
#
#

CocoaPods + Xcode Continuous Integration

Script:

cd ${SRCROOT}
if [ -e "Pods" ]
then
pod install
else
touch Pods
@m1entus
m1entus / gist:9666239
Last active August 29, 2015 13:57
Testing asynchronous call.md
// Set the flag for a block completion handler
#define FLSTART() __block dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);

// Set the flag to stop the loop
#define FLEND() dispatch_semaphore_signal(semaphore);

// Wait and loop until flag is set
#define FLWAIT() WAITWHILE(dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW))
@m1entus
m1entus / make_cert.sh
Last active March 12, 2018 19:36
Generating apple push notifications
#!/bin/sh
if [ "$#" != 3 ]; then
echo "Illegal number of parameters, usage: ./make_cert.sh apn_file key_file output_filename"
fi
eval "openssl x509 -in $1.cer -inform DER -out $1.pem -outform PEM"
eval "openssl pkcs12 -nodes -export -inkey $2.key -in $1.pem -out $1.p12"
eval "openssl pkcs12 -nodes -nocerts -out $2.pem -in $1.p12"
eval "cat $1.pem $2.pem > $3.pem"
@implementation NSDictionary (QuickLook)
- (id)debugQuickLookObject
{
NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:nil];
NSString *JSONString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString *embedHTML = [NSString stringWithFormat:@"<html><head></head><body><pre>%@</pre></body></html>",JSONString];
// http://stackoverflow.com/questions/17535918/aes-gets-different-results-in-ios-and-java
- (NSData *)AES256EncryptWithKey:(NSString *)key {
// 'key' should be 32 bytes for AES256, will be null-padded otherwise
char keyPtr[kCCKeySizeAES256+1]; // room for terminator (unused)
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding)
// fetch key data
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];
@m1entus
m1entus / dateFormatter.swift
Created July 23, 2014 08:01
Swift NSDateFormatter singleton
class var userDateFormatter : NSDateFormatter {
struct Static {
static let instance: NSDateFormatter = {
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
return dateFormatter
}()
}
return Static.instance
}
@m1entus
m1entus / sortBtProperty.swift
Created July 23, 2014 10:00
Swift generic function sorting by object property
func sortByProperty<T: NSObject>(array: [T], property: String, ascending: Bool) -> [T] {
var sortedBooks = [T](array)
sortedBooks.sort { element1, element2 in
var value1: AnyObject! = ""
var value2: AnyObject! = ""
if element1.respondsToSelector(Selector(property)) {
value1 = element1.valueForKey(property)