Skip to content

Instantly share code, notes, and snippets.

View gist:c84a2c25c081c023ba03
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 Jun 15, 2011
modified jenkins launch plist
We couldn’t find that file to show.
@chrisjaure
chrisjaure / deploy.js
Created Jul 29, 2012
Deploying nodejs apps with haibu and git
View deploy.js
#! /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 Dec 12, 2010
NSOutputStream subclass which updates a SHA1 checksum for all data written
View GGChecksummingOutputStream.h
//
// 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
@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 Mar 21, 2016
Fish versions of my bash commands from Lazy Automation
View fish_lazy_commits.sh
# 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 Mar 12, 2017
Just a UICollectionview cell animation on touch although it could be performed on any uiview.
View PulseTouchCollectionViewCell
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 Jun 5, 2017
Initial implementation of Evolution Strategies
View es.py
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 Mar 26, 2017 — forked from karpathy/nes.py
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
View nes.py
"""
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 Oct 10, 2017
vImage Blur Example
View blur.m
- (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 =