View gist:c84a2c25c081c023ba03
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
YapDatabaseViewGroupingWithObjectBlock groupingBlock = ^NSString *(NSString *collection, NSString *key, id object) { | |
if (![object isKindOfClass:[MealLogRemote class]]) { | |
return nil; | |
} | |
return "all"; // we only need one section/group in this case | |
}; | |
YapDatabaseViewSortingWithObjectBlock sortingBlock = ^NSComparisonResult (NSString *group, NSString *collection1, NSString *key1, MealLogRemote *obj1, | |
NSString *collection2, NSString *key2, MealLogRemote *obj2){ | |
// we don't need sorting but this using a sorting for a view is mandatory, lets sort it by date |
View deploy.js
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
#! /path/to/node | |
var haibu = require('/path/to/haibu'); | |
var client = new haibu.drone.Client(); | |
process.stdin.resume(); | |
process.stdin.on('data', function(data){ | |
var package = JSON.parse(data.toString()); |
View GGChecksummingOutputStream.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
// | |
// GGChecksummingOutputStream.h | |
// | |
// Created by Geoff Garside on 12/12/2010. | |
// Copyright 2010 Geoff Garside. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <CommonCrypto/CommonDigest.h> |
View MFBCollectionPreviewingAdapter.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
@import UIKit; | |
NS_ASSUME_NONNULL_BEGIN | |
@protocol MFBPreviewableCollectionView | |
- (nullable NSIndexPath *)mfb_previewableCollectionIndexPathForItemAtPoint:(CGPoint)point; | |
- (CGRect)mfb_previewableCollectionItemRectForIndexPath:(NSIndexPath *)indexPath; |
View fish_lazy_commits.sh
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
# http://artsy.github.io/blog/2016/03/02/Lazily-Automation/ | |
function git_branch_info | |
git branch ^/dev/null | grep \* | sed 's/* //' | |
end | |
function branch | |
git checkout master; | |
git pull upstream master; | |
git checkout -b $argv[1] |
View PulseTouchCollectionViewCell
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
import UIKit | |
@IBDesignable class PulseTouchCollectionViewCell: UICollectionViewCell { | |
@IBInspectable var scaleFactor : CGFloat = 1.3 | |
@IBInspectable var animationColor : UIColor = UIColor.green | |
@IBInspectable var startingOpacity : Float = 0.2 | |
@IBInspectable var animationDuration : Double = 0.8 | |
View es.py
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
import numpy as np | |
import gym | |
from gym.spaces import Discrete, Box | |
from gym.wrappers import Monitor | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation, Flatten | |
# ================================================================ | |
# Policies |
View nes.py
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
""" | |
A bare bones examples of optimizing a black-box function (f) using | |
Natural Evolution Strategies (NES), where the parameter distribution is a | |
gaussian of fixed standard deviation. | |
""" | |
import numpy as np | |
np.random.seed(0) | |
# the function we want to optimize |
View blur.m
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
- (UIImage *)boxblurImage:(UIImage *)image boxSize:(int)boxSize | |
{ | |
CGImageRef originalImageRef = image.CGImage; | |
CGColorSpaceRef originalColorSpace = CGColorSpaceRetain(CGImageGetColorSpace(originalImageRef)); | |
if (_pixelBuffer == NULL) { | |
_pixelBuffer = malloc(CGImageGetBytesPerRow(originalImageRef) * CGImageGetHeight(originalImageRef)); | |
} | |
vImage_CGImageFormat inputImageFormat = |
OlderNewer