You can't hire with certainty. Things move too fast to be absolutely sure of everyone. And if you're certain of everyone it's because you're looking at the same signals you know. You're not allowing for adding something new, something different. You can fire with certainty. After people have been in your company for a month or two, you have a pretty good idea what they're about. Derek Sivers' rule…
We wanted just-in-time permissions at Oscilar. The rules are simple: everyone gets read-only by default. If you need to change something, you ask for higher access for a short time. When the time is up, the access ends. I looked at two vendors. Both were about $1000 per seat per year. We have 60 people. That’s $60K a year. If we double headcount, it becomes $120K. For what we needed, that felt…
Twilio acquired Segment for $3.2 billion in an all-stock deal. I was Segment's 4th engineering hire. I'd finished working at 37signals at my one year Prototyper gig . I worked with Jason Fried, DHH, and Ryan Singer. Every time I went out for dinner with people from the company they would ask me how it was working with Ryan Singer, and then go into their stories about him. I liked working with…
I began programming with Emacs but didn’t get it. I switched to Vim for a few years, liked its motions but hated its extensibility, and switched back to Emacs. That was 25 years ago. Emacs has never been the most popular text editor and never will be. Popularity requires accessibility, immediate appeal, and marketing. Emacs has none of these. You install it, open it up, and see what looks like a…
Most people who would bother with the matter at all would admit that the layout of Go projects is in a bad way. To pkg, or not to pkg, that is the question. To put your project’s libraries under a directory named pkg, or not? The pkg convention started when, prior to Go 1, the Go team put the stdlib in $GOROOT/src/pkg. Later they deleted the pkg directory and moved the stdlib to $GOROOT/src.…
There’s a magical address in EC2 that you can query to get metadata on that instance ( http://169.254.169.254 ). What’s especially awesome about it, is that you can use it inside Docker containers which makes it an easy way to find the host IP from inside the container without having to pass it in via an env var or equivalent. Behold! I’m curling inside a Docker container and from the host and…
I wrote a worker to track consumer offset lags with StatsD so that you can graph them in Grafana or something similar. It’s written in Golang and there’s a Docker image too, so it’s easy to deploy and use. Check it out on GitHub.
Make sure you’ve installed and configured the aws-cli and jq . Drop this function into your .zshrc or .bashrc: function ec2-ssh () { ssh $( aws ec2 describe-instances --filter Name = instance-id,Values = $1 | jq '.Reservations[0].Instances[0].PrivateIpAddress' | tr -d '"' ) } And now you can ssh into your EC2 instance: $ ec2-ssh i-6g5c7ed4
Using Docker and VirtualBox and having trouble making outbound connections? You may have errors similar to: curl: (7) Failed connect to 10.0.2.224:8000; No route to host Error: Redis connection to redis:6379 failed - connect EHOSTUNREACH Here’s what I did to fix it: I ssh’d into the Docker machine: $ docker-machine ssh dev ``` Checked eth0’s subnet: $ ifconfig eth0 eth0 Link…
I thought it’d be cool to show what albums I’m listening to lately on my site, so I wrote a client lib and and Amazon Lambbda function to get the albums from your Rdio Heavy Rotation and put them on your site. You can check it out on my site under “the heavy rotation”. The Lambda function authenticates with Rdio and fetches the data for the client, and the client adds the…
Koa is a web framework that’s the next generation Express in that it’s built by the same team, and aims to be smaller, more expressive, and more robust for building web applications and APIs. It accomplishes this in large part by using generators which enables writing asynchronous JS without callbacks and greatly simplifies flow control and handling errors. In this article I’m…
Here’s how you can write docker images that you can pipe into: Dockerfile, here I’m installing the go programs I’m going to run and pipe into: FROM golang RUN go get github.com/segmentio/throttle RUN go get github.com/segmentio/json_to_nsq COPY entrypoint.sh /entrypoint.sh CMD [ "/bin/sh" , "/entrypoint.sh" ] entrypoint.sh, here I’m reading from stdin and piping into the…
Here’s how to use Ido in Emacs to write your own interactive functions with completion. In this example, we’ll make a function that completes directories but Ido provides functions for reading files, buffers, and more. This function will go to the given repo in my dev directory, and if that repo isn’t cloned yet, will clone it from my GitHub first. ( defun tj-goto ( repo ) "Go to…
From a very high level POV, here’s how Segment’s API used to work and works now: Our traffic is to the point where performance problems started emerging where we were blocking our Node api’s event loop, primarily due to object reification when serializing JSON. To alleviate this issue, we put an api in-front of the api, which we call the tracking api. The tracking api is written…
Been meaning on shipping this project for a while now. TRVSURLSessionOperation is an NSOperation subclass that wraps NSURLSessionTask so you can use them in a NSOperationQueue . Check it out on GitHub . With this you can: Schedule network requests (i.e. run request A then request B, and give requests priority) Limit the number of concurrent network requests (e.g. have 5 network requests running at…
I released Jasmine-jQuery v2.0.0 which adds support for Jasmine v2.0.0. Jasmine v2 removed support for replacing built-in matchers, which Jasmine-jQuery made use of to replace toBe() and toContain() , so there are API changes: toBe() is now toEqual() toContain() is now toContainElement() Go get it. Meanwhile, I’ll see about patching Jasmine to re-add that feature…
While writing my own debugging lib, an idea I was toying with was having a debug macro look like one of the built-in @ compiler directives, e.g. @selector, @encode, etc. Since macro names must be identifiers, and identifiers can’t have @s in them . You can’t do this: #define @debug(fmt, ...) \ NSLog(fmt, ##__VA_ARGS__) The trick, we’ll write our macro such that the macro…
Recently added to Clang v3.4 are awesome tools for formatting your code and a new command clang-format . Clang format can style code to guidelines of LLVM, WebKit, Google, Chromium, Mozilla, or you can create your own configurations. I wrote an Xcode plug-in to use clang-format from within Xcode : Pretty neat. This was my first Xcode plug-in so that was pretty interesting and I learned a lot about…
Update: I wrote this code to show that iA was patenting a feature built into Apple’s frameworks. Any iOS developer could build the same feature with ten lines of code. John Gruber linked my project on Daring Fireball. iA dropped their pending patents. Here’s how to implement Writer Pro’s syntax highlighting feature with attributed strings and NSLinguisticTagger. Project on…
If you’re using Interface Builder with auto layout and go to write some layout constraints in code you may run into the following error - where the constraints you’ve added in code conflict with layout constraints ‘IB auto generated at build time for view with fixed frame’. To prevent this, and to be able to do your layout constraints in code while not conflicting with interface builder, add…
You’re likely here because you thought you could just do this: NSTextView * textView = [ NSTextView new ]; [ textView setEditable : NO ]; [ textView setAutomaticLinkDetectionEnabled : YES ]; [ textView setString : @"homesite: http://travisjeffery.com/ and twitter: http://twitter.com/travisjeffery" ]; // ... And you’d have clickable links in your NSTextView. Nope. setAutomaticLinkDetectionEnabled:…
This week I switched from working on iOS apps at 37signals to working on a similar mac app. I wanted to shared code between the ios and mac app, this is easy to do with foundation classes - my model and networking code. But doesn’t work right out of the box for stuff like images, colors, fonts, since they’re either in UIKit or AppKit. Thankfully you can adapt code for images, colors,…
UIScrollViewDelegate has the method: -[UIScrollViewDelegate scrollViewDidEndDragging:willDecelerate:] , and the decelerate parameter is NO when the scroll view has finished scrolling. So you could use it like this: - ( void ) scrollViewDidEndDragging: ( UIScrollView * ) scrollView willDecelerate: ( BOOL ) decelerate { if ( ! decelerate ){ NSLog ( @"The scroll view isn't scrolling anymore." ); //…
TRVSEventSource provides an api for opening an http connection for receiving push notifications from a server in the form of server-sent events . Mozilla Developer Network has a good page on server-sent events and event source usage too. usage TRVSEventSource * eventSource = [[ TRVSEventSource alloc ] initWithURL :[ NSURL URLWithString : @"http://127.0.0.1:8000" ]]; [ eventSource…
I wrote TRVSMonitor , a synchronization construct with the ability to wait until signalled that a condition was met. This makes asynchronous testing easy. TRVSMonitor works with any testing framework too. @interface APIClientTests : XCTestCase @property ( nonatomic , strong , readwrite ) NSURLSession * URLSession ; @end @implementation APIClientTests - ( void ) setUp { self . URLSession = […
When i’m hacking on open source libs i maintain, i often have to clean up the commits of people’s prs. I wanna give attribution for good contributions and not have my name associated with nasty hacks, so when i interactively rebase commits i want to make sure the new commit(s) has the right author. By default when you interactively rebase, git will say you’re the author. So you…
If you’re running your app in Xcode and the simulator, they may hang saying Attaching to your app name... . To fix this and run your app in the simulator with the lldb debugger, go into your app’s target, and explicitly set the deployment target to the version of the simulator to run. For me, right now, that’s 7.0 . If left blank, or with the placeholder, Xcode isn’t smart…
I maintain jasmine-jquery, a library providing jquery matchers and fixture loading for jasmine. Recently, I setup jasmine-jquery with grunt , a javascript task runner. This way, I can run the test suite from the command-line, and have continuous integration with travis-ci — so collaborators know when they broke something. In the process of setting all this up, I learned about grunt, and using…
It’s a bit tricky to install Ruby on Mac OS X Maverick (10.9), but here’s what worked for me. Upgrade to Mavericks: https://itunes.apple.com/us/app/os-x-mavericks/id675248567 Upgrade to Xcode 5: https://itunes.apple.com/us/app/xcode/id497799835 Install the old C compiler to support apps on Ruby 1.8: brew install apple-gcc42 Let the old compiler know about Xcode 5. Add this to your…
Recently ran into this issue where Google Chrome wouldn’t open iTunes links (e.g. links to WWDC videos, iOS apps, songs, etc.), a while ago I’d set Chrome to remember not open those links (oops). Rather than blowing away all your settings in Chrome, here’s the fix: Open up this file ~/Library/Application Support/Google/Chrome/Local State Find the line containing either itms or…