This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
static int size = 64; | |
int stripedMapPseudoHash(uintptr_t addr) { | |
return ((addr >> 4) ^ (addr >> 9)) % size; | |
} | |
int main(int argc, const char * argv[]) { | |
int numericMap[size]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSURL-Extensions.h | |
// url-modificator | |
// | |
// Created by yury.lapitsky on 26/12/2016. | |
// Copyright © 2016 yury.lapitsky. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sublime links setup | |
sudo rm -rf /usr/local/bin/subl | |
sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/ | |
subl . | |
# Homebrew packages | |
# bash-completion, carthage, swiftlint, rbenv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Last commit diff | |
git log -p -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -f "$1" | |
zip -X0 "$1" mimetype | |
zip -X9Dr "$1" META-INF OEBPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIViewController (RAC) | |
- (RACCommand *)showCommandWithPresenter:(RACSignal *)presenter { | |
RACSignal *presentedControllerDataSignal = [RACSignal return:self]; | |
return [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) { | |
RACSignal *presentDataSignal = [presenter combineLatestWith:presentedControllerDataSignal]; | |
return [presentDataSignal.deliverOnMainThread flattenMap:^RACStream *(RACTuple *tuple) { | |
return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { | |
UIViewController *presenterController = tuple.first; | |
UIViewController *controllerToPresent = tuple.second; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef BOOL(^PassRuleBlock)(id first, id second); | |
- (RACSignal *)distinctBasedOnRule:(PassRuleBlock)passRuleBlock { | |
Class class = self.class; | |
return [[self bind:^{ | |
__block id lastValue = nil; | |
return ^(id x, BOOL *stop) { | |
if ((passRuleBlock(x, lastValue) == NO)) { return [class empty]; } |