Skip to content

Instantly share code, notes, and snippets.


Sergey Gavrilyuk gavrix

  • Shopify
  • Toronto, ON
Block or report user

Report or block gavrix

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:ef15d46434c0e083fff53653cba55210
pcm.!default {
type plug
slave.pcm {
type dmix
ipc_key 1024
slave {
pcm "plughw:0,0"
rate 48000 # this line is only needed for USB DACs which only support 48khz
period_time 0
period_size 1920
View NSStringHack.m
@interface NSString (ss)
- (NSString *):(NSString *)str;
@implementation NSString (ss)
- (NSString *):(NSString *)str {
return [NSString stringWithFormat:self, str];
View Enums.swift
enum EndPoints {
case GetUser
case UpdateUser(userData: User)
extension ParseEndpoints: HTTPEndPointConvertible, HTTPEndPointDSL {
func toHTTPEndPoint() -> HTTPEndPoint {
let baseURL = ""
switch (self) {
gavrix / gist:10488144
Last active Aug 29, 2015
Is it crazy?
View gist:10488144
((void (^)())@[
^{[self action2];},
^{[self action1];} ][value.boolValue])();
if (value.booldValue) {
[self action1];
gavrix / gist:8961770
Last active Aug 29, 2015
objc NSDictionary literals vs c-style switch
View gist:8961770
NSInteger sourceIntValue;
id mappedValue = (@{@(kSomeConstValue1): KSomeConstMappedValue1,
@(kSomeConstValue2): KSomeConstMappedValue2}[@(sourceIntValue)])?:KSomeConstMappedDefaultValue;
id mappedValue;
switch(sourceIntValue) {
case kSomeConstValue1:
View gist:5785069
@interface UIScrollView (willBeginScrollingAnimation)
@implementation UIScrollView (willBeginScrollingAnimation)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-method-access"
+(void)load {
Method setContentOffsetAnimatedMethod = class_getInstanceMethod([UIScrollView class], @selector(setContentOffset:animated:));
IMP oldImplementation = method_getImplementation(setContentOffsetAnimatedMethod);
gavrix / gist:5054182
Created Feb 28, 2013
Script integrating OCLint into XCode. Put it in "Run script" build phase.
View gist:5054182
source ~/.bash_profile
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
View NSArray+first.h
@interface NSArray (addition)
-(id) firstObject;
You can’t perform that action at this time.