Skip to content

Instantly share code, notes, and snippets.

View michaelenger's full-sized avatar

Michael Enger michaelenger

View GitHub Profile
@michaelenger
michaelenger / loadModule.js
Created October 30, 2014 14:10
Dependency injection in node
/**
* Loads a module with the means to inject mocks.
* Usage:
* module = require('module-name'); // old and busted
* module = loadModule('/path/to/module-name.js', { // new hotness
* 'mocked-module-name': {}
* });
*
* Thanks to: http://howtonode.org/testing-private-state-and-mocking-deps
*
@michaelenger
michaelenger / Note.swift
Created June 23, 2014 19:46
iOS Development Using Swift
//
// Note.swift
// Example Notes
//
// Created by Michael Enger on 21/06/14.
// Copyright (c) 2014 Michael Enger. All rights reserved.
//
import UIKit
import CoreData
@michaelenger
michaelenger / Vagrantfile
Last active August 29, 2015 13:59
Witi Vagrant example
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The box (VM image) to use. vagrantcloud.com has a list of possible ones, but I'm a Debian/Ubuntu guy.
config.vm.box = "nfq/wheezy"
@michaelenger
michaelenger / modifyFastaHeaders.py
Created December 21, 2013 21:29
Example of how to use regular expressions to modify FASTA headers. See: https://en.wikipedia.org/wiki/FASTA_format
#!/usr/bin python
# We're using the sys and re modules
import sys
import re
# This is the function which will do our replacing
def modify_fasta_headers(inpath, outpath):
# Open the in and out files
infile = open(inpath, "r")