Skip to content

Instantly share code, notes, and snippets.

View jakemmarsh's full-sized avatar

Jake Marsh jakemmarsh

View GitHub Profile
@jakemmarsh
jakemmarsh / binarySearchTree.py
Last active September 26, 2022 18:06
a simple implementation of a Binary Search Tree in Python
class Node:
def __init__(self, val):
self.val = val
self.leftChild = None
self.rightChild = None
def get(self):
return self.val
def set(self, val):
@jakemmarsh
jakemmarsh / filters.js
Created July 16, 2013 14:03
AngularJS filter to create links out of URLs
app.filter('parseUrl', function() {
var //URLs starting with http://, https://, or ftp://
replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim,
//URLs starting with "www." (without // before it, or it'd re-link the ones done above).
replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim,
//Change email addresses to mailto:: links.
replacePattern3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
return function(text, target, otherProp) {
angular.forEach(text.match(replacePattern1), function(url) {