Skip to content

Instantly share code, notes, and snippets.

View dcorb's full-sized avatar

David Corbacho dcorb

View GitHub Profile
@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) {
@dominicsayers
dominicsayers / phantomjs.md
Last active November 21, 2016 01:59
Installing PhantomJS on Ubuntu

(updated version of http://www.joyceleong.com/log/installing-phantomjs-on-ubuntu/)

  1. export P=phantomjs-2.1.1-linux-x86_64
  2. cd /usr/local/share
  3. sudo curl -L -o $P.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/$P.tar.bz2
  4. sudo tar xvf $P.tar.bz2
  5. sudo ln --force -s /usr/local/share/$P /usr/local/share/phantomjs
  6. sudo ln --force -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs
  7. phantomjs --version