Skip to content

Instantly share code, notes, and snippets.

View ashfurrow's full-sized avatar

Ash Furrow ashfurrow

View GitHub Profile
@ashfurrow
ashfurrow / gist:b9fa03387ca8c68bc07e
Last active August 29, 2015 14:03
Crashing on Unowned reference access
// from https://twitter.com/ashfurrow/status/482488815266045952
func foo (closure: (Array<Int> -> ()) -> ()) {
closure({ (array: Array<Int>) -> () in
for i in array {
i
}
})
}
### Keybase proof
I hereby claim:
* I am ashfurrow on github.
* I am ashfurrow (https://keybase.io/ashfurrow) on keybase.
* I have a public key whose fingerprint is 006F 20AD 6193 CAC3 2413 6FF3 DDB3 AF9C 765E 0680
To claim this, I am signing this object:
@ashfurrow
ashfurrow / gist:8411942
Created January 14, 2014 02:19
Docbook parser I wrote in my universities days.
import Text.XML.Light.Input
import Text.XML.Light.Types
{-
Dear Markers:
Some known issues:
1. if an ordered list item contains a sublist, that list item doesn't get numbered
2. given an itemized list, the asterisks align with the start of the letters, not two spaces before them
3. there's an extra newline inserted at the end of the file
Those are all the issues I can think of and they are illustrated in the test cases, which are included at the end of this file. After 10 hours of working on this assignment, I'm calling it "done enough".
@ashfurrow
ashfurrow / RXCollections.podspec
Last active December 25, 2015 13:39 — forked from tonyarnold/RXCollections.podspec
Note that this is OSX only. Don't know how to deal with the whole NSSize/CGSize, etc dance.
Pod::Spec.new do |s|
s.name = "RXCollections"
s.version = "1.2.1"
s.summary = "map, filter, fold, and detect for Cocoa collections."
s.homepage = "https://github.com/robrix/RXCollections"
s.license = 'BSD'
s.platform = :osx, '10.8'
s.author = { "Rob Rix" => "[email protected]" }
s.framework = 'Foundation'
s.source = { :git => "https://github.com/robrix/RXCollections.git", :tag => "#{s.version}" }
Issue = mongoose.model("Issue", {
identifier: String,
date: String,
url: String,
name: String,
thumbnailURL: String
});
function issues(request, response) {
response.setHeader('Content-Type', 'text/json');
@ashfurrow
ashfurrow / gist:5976579
Last active February 29, 2020 06:15
Image Blurring – Accelerate vs. CoreImage

1.3MB png 640x1136

  • Accelerate 179ms every time
  • CoreImage 298ms first time 147ms subsequent times @1x scale
  • CoreImage 262ms first time 126ms subsequent times @0.5x scale
  • CoreImage 260ms first time 118ms subsequent times @0.25x scale

(Lower on 0.5x probably because of whole number for blur radius)

@ashfurrow
ashfurrow / gist:5797375
Created June 17, 2013 14:38
Array access performance tests
/*
Results on iPad 4th gen with -O3 compiler optimizations:
2013-06-17 10:37:34.688 Labs Project[11717:907] for loop took 0.160626 seconds
2013-06-17 10:37:36.691 Labs Project[11717:907] enumerateObjectsUsingBlock took 0.159356 seconds
*/
{
@ashfurrow
ashfurrow / gist:5658708
Last active December 17, 2015 19:09
ReactiveCocoa Find Max Value in Array
CGFloat max = [[numbersArray.rac_sequence foldLeftWithStart:@(FLT_MIN) combine:^id(id accumulator, id value) {
if (value == [NSNull null]) return accumulator;
if ([accumulator floatValue] < [value floatValue]) return value;
else return accumulator;
}] floatValue];
@ashfurrow
ashfurrow / gist:5638997
Created May 23, 2013 20:04
Stopping a UICollectionView from Scrolling
-(CGSize)collectionViewContentSize {
return self.collectionView.bounds.size;
}