Skip to content

Instantly share code, notes, and snippets.

View gogogarrett's full-sized avatar

Garrett Heinlen gogogarrett

  • Netflix
  • San Francisco, CA
View GitHub Profile
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@thijsc
thijsc / gist:1391107
Created November 24, 2011 11:08
Select item from chosen js select with Capybara and Selenium
def select_from_chosen(item_text, options)
field = find_field(options[:from])
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()")
page.execute_script("$('##{field[:id]}').val('#{option_value}')")
end

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@andrew8088
andrew8088 / detectives.sql
Created July 6, 2012 01:41
Intrepid Detectives database for the SQL Essentials course for Tuts+ Premium
CREATE DATABASE intrepid_detectives;
USE intrepid_detectives;
CREATE TABLE detectives(
id INTEGER NOT NULL AUTO_INCREMENT,
first_name VARCHAR(50),
last_name VARCHAR(50) NOT NULL,
phone_number VARCHAR(10) NOT NULL,
certification_date DATE NOT NULL,
CONSTRAINT detectives_pk PRIMARY KEY (id)
@colinta
colinta / expose_controller.rb
Last active December 11, 2015 00:49
ExposeController
# given a target and slideView, this class will manage a slide out view.
#
# ExposeController.new(target, slideView, options)
#
# target: this is the view that the pan gesture will be added to, can be the same as the slideView.
# slideView: this is the view that will be moved to the right, should be a container view of some sort.
# delegate: the expose controller delegate
#
# It is assumed that the *exposed view* is organized below the slideView, and
# so it will be exposed when the slideView is moved.
@colinta
colinta / hozizontal_pan_gesture.rb
Created January 17, 2013 18:49
Only responds to horizontal gestures, within 4 pixels of the starting location.
class HorizontalPanGestureRecognizer < UIPanGestureRecognizer
DirectionPanThreshold = 4
def initWithTarget(target, action: action)
super.tap do
my_reset
end
end
def touchesMoved(touches, withEvent:event)
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.