Skip to content

Instantly share code, notes, and snippets.

@averydev
averydev / Objective-C Singleton
Created March 12, 2013 01:16
Handy method for maintaining an Objective-C Singleton
+ (MyClass *)sharedInstance
{
static MyClass *sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedInstance = [[MyClass alloc] init];
// Do any other initialisation stuff here
});
return sharedInstance;
<!-- Solution brought to you by Caroline Schnapp -->
<!-- See this: http://wiki.shopify.com/Related_Products -->
{% assign image_size = 'compact' %}
{% assign heading = 'Other fine products' %}
{% if product.tags.size > 0 %}
<h3>{{ heading }}</h3>
<ul class="related-products"></ul>
@averydev
averydev / gist:11380185
Created April 28, 2014 18:31
ViewController template
#pragma mark - Standard VC state management
- (void)viewDidLoad
{
[super viewDidLoad];
/*
One-time setup tasks here
*/
}
var doc = context.document;
for (var i = 0; i < doc.pages().count(); i++) {
var page = doc.pages().objectAtIndex(i);
for (var j = 0; j < page.artboards().count(); j++) {
var artboard = page.artboards().objectAtIndex(j);
@implementation ELFFadeAndSlidePushAnimator
- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext{
return 0.35;
}
-(void) animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext{
UIView * containerView = [transitionContext containerView];
NSTimeInterval duration = [self transitionDuration:transitionContext];
{
"meta": {
"data_type": "array",
"item_type": "Doctor",
"total": 4,
"count": 4,
"skip": 0,
"limit": 10
},
"data": [
@averydev
averydev / components.input-component.js
Last active June 25, 2016 01:02
DDAU Input Field Pattern
import Ember from 'ember';
const {computed} = Ember;
export default Ember.Component.extend({
sourceProperty:null,
proxyProperty:computed('sourceProperty', {
get(key){
return this.get('sourceProperty');
},
@averydev
averydev / EmberFilterExample.js
Created December 23, 2016 00:10
How can this be refactored?
//controller
filtered: Ember.computed('filterFn', function (){
return this.get('filterFn')(this.get('allProducts'))
},
actions:{
updateFilter: function (newFilterFn){
this.set('filterFn', newFilterFn)
}
objc[60124]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x10c19e998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x10bf1d880). One of the two will be used. Which one is undefined.
2017-02-10 13:03:34.090 Elevation Fitness[60124:69276564] I restkit:RKLog.m:49 RestKit logging initialized...
2017-02-10 13:03:34.154 Elevation Fitness[60124:69276564] Success excluding Elevation Fitness In House from backup
2017-02-10 13:03:34.161 Elevation Fitness[60124:69276564] [HockeySDK] WARNING: Detecting crashes is NOT enabled due to running the app with a debugger attached.
2017-02-10 13:03:34.190 Elevation Fitness[60124:69276564] SYNC: start
2017-02-10 13:03:34.193 Ele
@averydev
averydev / .block
Last active May 22, 2017 03:39
Isometric Test
license: gpl-3.0