Skip to content

Instantly share code, notes, and snippets.

View ashfurrow's full-sized avatar

Ash Furrow ashfurrow

View GitHub Profile
travis_fold:start:worker_info
Worker information
hostname: worker-jupiter-brain:86e580e8-c3d3-4eae-ad88-b68c1904e62a
version: v2.0.0 https://github.com/travis-ci/worker/tree/ca6cb0c5d3920912b1c3acc87c44a5da2120a971
instance: 151f0690-007b-4ca9-ac94-fe657b47fe02:
startup: 1m30.060489533s
travis_fold:end:worker_info
travis_fold:start:system_info
Build system information
title
Being a Good OSS Citizen

Let's take a look at the day in the life of an open source citizen, me. I was given an issue that would allow suers to refine what kinds of sale artworks they were looking at, and it included this awesome slider so they could set min/max price ranges.

Nice.

require 'nokogiri'
require 'open-uri'
require 'cgi'
episodes = Array.new
doc = Nokogiri::HTML(open("http://www.notificationcenter.tv/feed.rss"))
episodes = doc.xpath("//item")
import UIKit
protocol LocationManagerDelegate {
func retrievedMapLocation(location: Int)
}
class LocationManager {
var delegate: LocationManagerDelegate?
func getLocations() {

It's been over a year since developers began using Swift to write iOS applications, and we've seen the Cocoa community expand in all directions in an effort to discover the best practices of Swift. Some of these explorations have been fruitful, and some have not. This talk presents advice to help you distinguish between what's cool and what's smart. Between substance and hype. Bring an open mind.

class MyClass {
var example: String = ""
}
let a = MyClass()
// The state of a is that example is ""
a.example = "hi"

So you want things that are far away to be out of focus. Cool. The best way to do this is focus closer to you, so that things further away aren't in focus.

But that is impeded by a few things. As things get further from your lens, DoF gets inherently wider and wider, so getting a narrow DoF for far away things means you need to overcompensate by focusing even closer than you actually want.

To get a narrower DoF, you should open your aperture up (just like normal). But open it up more than usual to overcompensate for the distance again. Fully open if you can. The problem then becomes shutter speed; on a sunny day, opening your lens up will overexpose the photo, even at fast shutter speeds.

The solution is to block out light entering the lens with a neutral density (ND) filter. I like variable ones that you twist to adjust between 2-9 stops of light. Then you can play around and experiment.

The last thing is the lens you're using. Getting narrow DoF is harder on wider lenses. If you use a longer lens, y

@ashfurrow
ashfurrow / gist:bbb04f8272c2f32d5bb7
Created January 28, 2015 18:26
Never-null combined assertion/assignment macro
// From https://twitter.com/tewha/status/560497711397355520
#define NEVER_NULL(a, desc, ...) ({\
do {\
__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS\
if ((a) == nil) {\
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd\
object:self file:[NSString stringWithUTF8String:__FILE__]\
lineNumber:__LINE__ description:(desc), ##__VA_ARGS__];\
}\

Wordpress-to-Middleman

So I'm moving my site from Squarespace to Middleman, a static website engine. Squarespace lets you export your content in a Wordpress-compatible XML file. I wrote this script to generate Middleman blog entries corresponding to published posts from the Squarespace exported XML file.

What it Does

So what does it do? It finds all published text posts and reconfigures them for use with Middleman. All Squarespace-hosted images are downloaded to your computer and given unique names, and the img tags in the posts themselves are updated. I also fix a few other things like Instagram and Vimeo embeds and added some bootstrap CSS classes to img tags. It's pretty customized to my needs – not a general-purpose script.

@ashfurrow
ashfurrow / gist:4dbe36d0faf65ce69ecd
Created October 21, 2014 14:13
Breakpoint errors
error: <EXPR>:1:8: error: consecutive statements on a line must be separated by ';'
(void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
^
;
error: <EXPR>:1:53: error: expected ',' separator
(void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
^
,
<EXPR>:1:68: error: expected ',' separator
(void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];