Skip to content

Instantly share code, notes, and snippets.

# 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 3 if you're running Vintage or Vintageous
# (Vim) modes, 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.
from selenium.common.exceptions import NoSuchElementException, TimeoutException
class DomHelper(object):
driver = None
waiter = None
def open_page(self, url):
self.driver.get(url)
@karlhorky
karlhorky / vagrant-port-forwarding.md
Last active November 16, 2017 19:24 — forked from altryne/vagrant-port-forwarding.md
Vagrant Port Forwarding on OS X Yosemite

Vagrant Port Forwarding (8080 -> 80, 8443 -> 443) with pf on OSX Mavericks/Yosemite

This guide is a fork from this gist.

Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

1. Create the anchor file

Create an anchor file under /etc/pf.anchors/com.vagrant with your redirection rule like:

rdr pass on lo0 inet proto tcp from any to any port 80 -> 127.0.0.1 port 8080
<!--
Example 1: Using IF ELSE logic
Works with Outlook (Desktop)?: Yes
Works with Outlook.com?: No
When using IF ELSE logic, Outlook.com will remove content in both conditionals, which is problematic.
-->
<!--[if mso]>
<table border="0" cellpadding="0" cellspacing="0" width="100%">

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@karlhorky
karlhorky / epub.sh
Last active August 29, 2015 14:27 — forked from ilyakava/epub.sh
Input an arg of a file of a list of links, get an output.epub of all those webpages concatenated
#!/bin/bash
COUNT=1
for link in $(cat $1)
do
wget -O - -o /dev/null $link | iconv -f iso8859-1 -t utf-8 > $COUNT.html
COUNT=$(echo $COUNT + 1 |bc)
done
@karlhorky
karlhorky / github_comment_on_commit.py
Created November 21, 2015 08:50 — forked from rmcgibbo/github_comment_on_commit.py
Jenkins setup to automatically comment on github commits with build status
// Using the Jenkins Groovy Post build plugin to execute the following after every build
// https://wiki.jenkins-ci.org/display/JENKINS/Groovy+Postbuild+Plugin
// It would be nice not to have to specify these here... the repo name should be available within the hudson
// api somehow, but I didn't know how to get it. The access token should maybe be saved in a config file, and
// read in at runtime?
GITHUB_REPO_NAME = 'myusername/myreponame'
GITHUB_ACCESS_TOKEN = 'my_github_api_v3_access_token'
@karlhorky
karlhorky / index.js
Created February 22, 2016 14:53 — forked from royriojas/index.js
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the right
var esformatter = require( 'esformatter' );
var esformatterJSX = require( 'esformatter-jsx' );
//var collapser = require( 'esformatter-collapse-objects' )
var throttle = require( 'lodash.throttle' );
var hash = window.location.hash.substr( 1 );
var extend = require('extend');
var params;
function getOrderDetails(orderID) {
return db.find( "orders", orderID ).then(order =>
db.find( "customers", order.customerID ).then(customer => ({order, customer}))
).then(({order, customer}) =>
Object.assign(order, {customer})
);
}
getOrderDetails( 1234 )
.then( displayOrder, showError );
@karlhorky
karlhorky / Loop-react-motion.js
Created July 20, 2016 16:20 — forked from bsansouci/Loop-react-motion.js
Example Loop component React-Motion
let Loop = React.createClass({
getInitialState() {
return {
isMovingToEnd: true
};
},
endValue(currVals) {
let {endValueProp, isDone, startValue} = this.props;
let {isMovingToEnd} = this.state;