Skip to content

Instantly share code, notes, and snippets.

@davidhooey
davidhooey / p4merge4git.md
Created June 14, 2017 14:55 — forked from tony4d/p4merge4git.md
Setup p4merge as a visual diff and merge tool for git
@davidhooey
davidhooey / promisedRequest.js
Created October 19, 2016 14:03 — forked from anandsunderraman/promisedRequest.js
Node.js request with Q promises
//import the http library
var http = require('http'),
//npm install q before requiring it
Q = require('q');
//a js object with options
var googleNewsOptions = {
hostname: 'ajax.googleapis.com',
path: '/ajax/services/search/news?v=1.0&q=nodejs',
method: 'GET'
@davidhooey
davidhooey / protips.js
Created January 3, 2016 23:49 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@davidhooey
davidhooey / xvfb
Last active August 29, 2015 14:21 — forked from jterrace/xvfb
Xfvb init script for ubuntu
# Installation
#
# 1. Install Xvfb
#
# sudo apt-get install xvfb
#
# 2. Add this file to /etc/init.d/xvfb
#
# 3. Make the script execuable.
#

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@davidhooey
davidhooey / bdd.rb
Created April 16, 2014 13:49 — forked from adkron/bdd.rb
class Fifo
EmptyError = Class.new(Exception)
Node = Struct.new(:value, :next)
attr_accessor :size, :top
private :size=, :top=
def initialize
self.size = 0
# 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.
@davidhooey
davidhooey / gist:4234887
Created December 7, 2012 17:30 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}