Skip to content

Instantly share code, notes, and snippets.

View corydolphin's full-sized avatar

Cory Dolphin corydolphin

View GitHub Profile
@enjalot
enjalot / cors_server.py
Created June 10, 2012 06:19
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@nrubin
nrubin / matlab.sublime-build
Last active August 17, 2017 14:21
Build System for Sublime Text 2 for MATLAB files on Windows
{
"cmd": ["C:\\Program Files\\MATLAB\\R2012b\\bin\\matlab", "-nosplash", "-nodesktop", "-r", "run('$file_name')"],
"selector": "source.m"
}
@bmhatfield
bmhatfield / .profile
Last active November 14, 2024 12:11
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@JamesBoon
JamesBoon / waitForElementClickable.js
Created January 3, 2018 15:10
Custom nightwatch command waitForElementClickable()
var util = require('util');
var WaitForElementVisible = require('nightwatch/lib/api/element-commands/waitForElementVisible');
function WaitForElementClickable() {
WaitForElementVisible.call(this);
this.expectedValue = 'clickable';
}
util.inherits(WaitForElementClickable, WaitForElementVisible);
@pm-dev
pm-dev / ApplesToOranges.kt
Last active April 30, 2018 16:45
Better type-safety with units in Kotlin
// Here's how unit type-safety can prevent you from performing invalid unit arithmetic
fun main(args: Array<String>) {
val oranges = Oranges(4)
val apples = Apples(4)
// Will result in compile time error:
println("Can't compare apples to oranges: ${apples == oranges}")
println("Can't add two unknown things to my apples: ${apples + 2}")