Skip to content

Instantly share code, notes, and snippets.

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
@taxilian
taxilian / gist:1028036
Created June 15, 2011 20:32
modified jenkins launch plist
We couldn’t find that file to show.
@chrisjaure
chrisjaure / deploy.js
Created July 29, 2012 17:16
Deploying nodejs apps with haibu and git
#! /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());
@geoffgarside
geoffgarside / GGChecksummingOutputStream.h
Created December 12, 2010 12:51
NSOutputStream subclass which updates a SHA1 checksum for all data written
//
// 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>
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
@protocol MFBPreviewableCollectionView
- (nullable NSIndexPath *)mfb_previewableCollectionIndexPathForItemAtPoint:(CGPoint)point;
- (CGRect)mfb_previewableCollectionItemRectForIndexPath:(NSIndexPath *)indexPath;
@orta
orta / fish_lazy_commits.sh
Created March 21, 2016 09:14
Fish versions of my bash commands from Lazy Automation
# 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]
@agibson73
agibson73 / PulseTouchCollectionViewCell
Created March 12, 2017 00:30
Just a UICollectionview cell animation on touch although it could be performed on any uiview.
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
@kashif
kashif / es.py
Last active June 5, 2017 12:07
Initial implementation of Evolution Strategies
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
@andrewssobral
andrewssobral / nes.py
Created March 26, 2017 00:19 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
"""
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
@palmerc
palmerc / blur.m
Last active October 10, 2017 02:38
vImage Blur Example
- (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 =