Skip to content

Instantly share code, notes, and snippets.

View mbriggs's full-sized avatar

Matt Briggs mbriggs

View GitHub Profile

I like OSX and I like Windows, have been a professional dev on both platforms. I totally understand where the post is coming from, but as a life long mac user, this is my perspective :)

I think the two big, major things the author missed are 1) OSX "power users" tend to be UNIX nerds, so doing things from the terminal is easy natural for them, and even if GUIs did exist they would probably go unused. While PowerShell is great, it is almost more of a scripting environment. UNIX is in my bones :) 2) When you buy a mac, expect to drop another 100-200$ on software to make it awesome (it is still reasonably easy to survive as a 1-2 man dev shop writing mac software as shareware, so there is a LOT of amazing shareware out there). By contrast, on windows, there is less software of that level of quality out there, but most of it is free. Good or bad, it is what it is, and has been that way for as long as I have had a mac (system 7 days)

  1. use http://www.alfredapp.com/ one of the best launchers out there for any O
(ns scrape-kuvva.core
(:require [scrape-kuvva.kuvva :as kuvva])
(:require [scrape-kuvva.files :as files]))
(def timeout 2000)
(defn sync
"Download any wallpaper that is
a) downloadable
b) not already downloaded"
@mbriggs
mbriggs / gist:5526196
Created May 6, 2013 16:23
functional api
# I think having the "functional" api to the rest of the system is the important part, if those functions happen to use objects, thats fine to me.
# in this case we are treating the "object" as a way to partially apply all the private functions to share the same arg
# IMO the only "danger" with using objects in this type of place is that you are going to hesitate if you want to add functions
# which do not use "all_events". In this case I think its probably fine, since "ReconcilesEvents" implies working on the full collection
class ReconcilesEvents
def self.tasks_that_have_not_ended(all_events)
new(all_events).unended_tasks
end

Sometimes, It's OK To Leave A Mess

Recently, we watched the excellent lunch and learn video from [Hashrocket][hashrocket], where [Sandi Metz][metz] [talks about test design][test-design]. While the whole video is worth watching, one thing that stood out to me was her term "Omega Mess".

Sometimes, there is something that you do based on experience, but it isn't formulated as a conscious thought. While very valuable, these understandings can become much more valuable when you are forced to explain them to someone else, because it stops being instinctual and becomes conscious.

The first time I heard someone refer to this concept was pairing with [Victor Savkin][savkin], where he referred to parts of the code as his "Dirty little secrets". While this is still my favourite name for the concept, I think Sandi's name of Omega Mess, meaning a mess that is at the end of everything, is far more apt, so I have used it ever since.

The Boyscout Rule

@mbriggs
mbriggs / details.js
Created April 11, 2013 14:53
marionettte tabbed-view container
var PrescriptionActions = TabbedView.extend({
tabs: {
"Prescription Info": DetailsView,
"Refill": RefillView,
"Renew": DetailsView
}
});
# in a simple case, I wish rails worked like this
messages = order.validate # returns errors array
if messages.empty?
order.save!
render 'show'
else
flash[:errors] = messages
render 'edit'
it("adds to the data in the custom handler", function(done){
repo.getSomething().then(function(data){
expect(data.success).toBe(true);
expect(data.foo).toBe('bar');
done();
});
});
@mbriggs
mbriggs / gist:4963698
Created February 15, 2013 21:29
terrible code with promises
var db = {
insertUser: function(email){
var result = defer();
client.query("INSERT INTO users(email, name) VALUES($1, $1)", [email], result.resolve);
return result.promise;
},
findUser: function(email){
@mbriggs
mbriggs / gist:4429104
Created January 1, 2013 18:17
Bruce Tognazzini - 2005

First of all, i grew up on mac os 6 and 7, and I would like to thank you for contributing to one of the most enjoyable experiences i have ever had from a computer. to this day, with dozen other operating systems under my belt, i still look back fondly to my days on os 7.

the unix editor vi flys in the face of every usability guideline on the planet. yet it has enjoyed widespread use and popularity, even amoung people who arnt forced to learn it. wouldnt new users want something that doesnt send their brain into tailspins when they operate it? wouldnt we get a natural selection effect, where given the

(add-hook 'magit-log-edit-mode-hook 'insert-ticket-number-from-branch-name)
(defun insert-ticket-number-from-branch-name ()
(erase-buffer)
(evil-insert-state)
(let* ((current-branch (car (vc-git-branches)))
(ticket-number (replace-regexp-in-string "[0-9]+\\(_.*\\)$" ""
current-branch nil nil 1)))
(when (string-match "^[0-9]" current-branch)
(insert (concat "#" ticket-number ": ")))))