Skip to content

Instantly share code, notes, and snippets.

View acefsm's full-sized avatar

acefsm acefsm

View GitHub Profile
@acefsm
acefsm / HUnorderedMap.hh
Created November 11, 2016 11:53 — forked from rsms/HUnorderedMap.hh
Testing (lookup) performance of different hash map algorithms for constant keys (pointer is hash)
#ifndef H_UNORDERED_MAP_
#define H_UNORDERED_MAP_
#import <tr1/unordered_map>
template<class K, class T>
class HUnorderedMap {
public:
typedef typename std::tr1::unordered_map<K, T > Map;
typedef typename Map::value_type ValueType;
#import <Foundation/Foundation.h>
NSString *decodeStringFromURLFormat(NSString *string)
{
NSString *result = [string stringByReplacingOccurrencesOfString:@"+" withString:@" "];
result = [result stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
return result;
}
NSString *encodeStringToURLFormat(NSString *string)
NSIndexPath *IndexPathWithOffset(UITableView *tableView, NSIndexPath *indexPath, NSInteger offset)
{
if (indexPath.row < 0 || indexPath.section < 0)
{
return nil;
}
if (offset == 0)
{
return indexPath;
}
@acefsm
acefsm / introrx.md
Created November 10, 2017 14:07 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
void __cdecl -[UITableViewController loadView](UITableViewController *self, SEL a2)
{
NSString *v2; // eax
struct objc_object *v3; // eax
UITableView *v4; // edi
struct objc_object *v5; // eax
int v6; // eax
UIStoryboard *v7; // eax
void *v8; // eax
void *v9; // eax
UITableViewController *__cdecl -[UITableViewController init](UITableViewController *self, SEL a2)
{
return (UITableViewController *)-[UITableViewController initWithStyle:](self, "initWithStyle:", 0);
}
UITableViewController *__cdecl -[UITableViewController initWithNibName:bundle:](UITableViewController *self, SEL a2, id a3, id a4)
{
int v4; // edi
UITableViewController *v5; // esi
@acefsm
acefsm / queues.md
Created February 6, 2018 19:26 — forked from weibel/queues.md
iOS persistent queue implementations

Persistent queues are really useful. I have envied Android developers for having the Tape queue http://square.github.io/tape/ and the Android Priority Jobqueue https://github.com/yigit/android-priority-jobqueue

Below I have compiled a list of the persistent queue implementations for iOS that I know of. Most of them are not in active development. Ping me if you want a library added to the list.

@acefsm
acefsm / SpinlockTestTests.swift
Created May 12, 2018 00:21 — forked from steipete/SpinlockTestTests.swift
Updated for Xcode 8, Swift 3; added os_unfair_lock
//
// SpinlockTestTests.swift
// SpinlockTestTests
//
// Created by Peter Steinberger on 04/10/2016.
// Copyright © 2016 PSPDFKit GmbH. All rights reserved.
//
import XCTest
@acefsm
acefsm / BNRTimeBlock.h
Created May 15, 2018 23:25 — forked from bignerdranch/BNRTimeBlock.h
Timing Utility Post 20120308
CGFloat BNRTimeBlock (void (^block)(void));
#include <stdatomic.h>
#include <stdint.h>
#include <stdbool.h>
/*!
An atomic ARC reference. Here's how it works:
The lowest bit of the pointer (mask 0x1) is used as a tag for the pointer being stored.
if the tag bit is set, that means that one thread currently owns this pointer, and will release it if the value has
been concurrently updated.