Skip to content

Instantly share code, notes, and snippets.

View infolock's full-sized avatar
👨‍👩‍👦‍👦
nqdq

infolock infolock

👨‍👩‍👦‍👦
nqdq
View GitHub Profile
@blackfalcon
blackfalcon / _roole_sass_interpolation.md
Last active December 12, 2015 07:59
Interpolation: Roole vs Sass

This was more or less a mential exersize in seeing what the differences are between Sass and Roole when it comes to interpolation. A conversation sparked from the Twitters.

As a result, I didn't come to the conclusion that Roole's supoprt of interpolation isn't any 'better' then Sass. In most cases, it is a simple syntatical difference. Sass simply adheres to Ruby's interpolation syntax.

But this review presented me with the opportuntiy to dig deeper into a few other features like scoping and extends.

Scoping

// Created by Nick Snyder on 11/13/12.
// https://gist.github.com/nicksnyder/4075682
// http://stackoverflow.com/questions/12927027/uicollectionview-flowlayout-not-wrapping-cells-correctly-ios
// NDCollectionViewFlowLayout.h
@interface NDCollectionViewFlowLayout : UICollectionViewFlowLayout
@end
@deholic
deholic / TableView.m
Created November 7, 2012 07:13
use transparent background UITableView on iOS 6
table = [[UITableView alloc] initWithFrame:frame style:UITableViewStyleGrouped];
// UITableView setBackgroundColor method is deprecated!
// use setBackgroundView!
[table setBackgroundView:nil];
[table setBackgroundColor:[UIColor clearColor]];
@nfarina
nfarina / UIView+FrameAdditions.h
Created August 21, 2012 06:40
UIView Frame helper getter/setter category methods
#import <UIKit/UIKit.h>
@interface UIView (SMFrameAdditions)
@property (nonatomic, assign) CGPoint $origin;
@property (nonatomic, assign) CGSize $size;
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect
@end
@hollance
hollance / NSObject+MHOverride.h
Created July 18, 2012 21:01
Overriding methods without making a subclass
@interface NSObject (MHOverride)
/*
* Dynamically overrides the specified method on this particular instance.
*
* The block's parameters and return type must match those of the method you
* are overriding. However, the first parameter is always "id _self", which
* points to the object itself.
*
@hollance
hollance / Explanation.md
Last active September 25, 2017 03:35
Communicate between objects using channels

Communicate between objects using channels

When you have two objects A and B, say two view controllers, that you want to have talk to each other, you can choose from the following options:

  • NSNotificationCenter. This is anonymous one-to-many communication. Object A posts a notification to the NSNotificationCenter, which then distributes it to any other objects listening for that notification, including Object B. A and B do not have to know anything about each other, so this is a very loose coupling. Maybe a little too loose...

  • KVO (Key-Value Observing). One object observes the properties of another. This is a very tight coupling, because Object B is now peeking directly into Object A. The advantage of KVO is that Object A doesn't have to be aware of this at all, and therefore does not need to send out any notifications -- the KVO mechanism takes care of this behind the scenes.

  • Direct pointers. Object A has a pointer to Object B and directly sends it messages when something of interest h

@hollance
hollance / gist:2936287
Created June 15, 2012 12:42
Drawing inner glow with Core Graphics
- (CGImageRef)createMaskFromAlphaChannel:(UIImage *)image
{
size_t width = image.size.width;
size_t height = image.size.height;
NSMutableData *data = [NSMutableData dataWithLength:width*height];
CGContextRef context = CGBitmapContextCreate(
[data mutableBytes], width, height, 8, width, NULL, kCGImageAlphaOnly);
@orta
orta / ARSearchBar.h
Created May 12, 2012 17:25
Custom Search Bar
//
// ARSearchBar.h
// Artsy Folio
//
// Created by orta therox on 18/04/2012.
// Released under The MIT License
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) 2012 http://art.sy. All rights reserved.
//
@kurtmilam
kurtmilam / deep_extend_javascript_objects_underscore_mixin.js
Last active October 3, 2020 14:56
Deep Extend / Merge Javascript Objects - underscore.js Mixin
/* Copyright (C) 2012-2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This mixin now has its own github repository: https://github.com/kurtmilam/underscoreDeepExtend
* It's also available through npm and bower
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFR
@yfujiki
yfujiki / Deep copy
Created January 23, 2012 18:48
Deep mutable copy category method of NSDictionary (ObjC)
- (NSMutableDictionary *) mutableDeepCopy {
NSMutableDictionary * returnDict = [[NSMutableDictionary alloc] initWithCapacity:self.count];
NSArray * keys = [self allKeys];
for(id key in keys) {
id oneValue = [self objectForKey:key];
id oneCopy = nil;
if([oneValue respondsToSelector:@selector(mutableDeepCopy)]) {
oneCopy = [oneValue mutableDeepCopy];