Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
philsturgeon / TwitterHighlights.snippet.php
Created June 23, 2012 18:19
MODX Revolution Output filter to create links from Twitter @name, #tag and URLs
<?php
/**
* TwitterHighlights
* Output filter to create links from Twitter @name, #tag and URLs
*/
$input = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" rel=\"nofollow\">\\2</a>", $input);
$input = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" rel=\"nofollow\">\\2</a>", $input);
$input = preg_replace("/@(\w+)/", "<a href=\"https://www.twitter.com/\\1\" rel=\"nofollow\">@\\1</a>", $input);
$input = preg_replace("/#(\w+)/", "<a href=\"https://www.twitter.com/search/\\1\" rel=\"nofollow\">#\\1</a>", $input);
@bencevans
bencevans / gist:4117847
Created November 20, 2012 13:05
Bubble Sort
function bubbleSort (sortingArray) {
var goto = sortingArray.length - 1;
for(var key in sortingArray) {
for(var i = 0; i <= goto - 1; i++) {
if(sortingArray[i] > sortingArray[i + 1]) {
// Swap
var temp = sortingArray[i];
sortingArray[i] = sortingArray[i +1];
sortingArray[i + 1] = temp;
}
@bencevans
bencevans / README.md
Last active December 12, 2015 04:39
Barton Internet Guard

Barton Internet Guard (Obsolete)

The proxy has been updated to use a new login design however this tool has not been updated.

Barton Peveril's WiFi requires authentication... every 15 mins.

When working on projects that require an internet connection this can easily break them. This gist/script automates the login process and can be run from terminal/cron job.

Requirements

@bencevans
bencevans / index.html
Created February 12, 2013 19:05
Leaflet.js + Open Sreet Maps Bootstrap
<html>
<head>
<title></title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" />
<![endif]-->
<style>
#map { height: 180px; }
</style>
@bencevans
bencevans / README.md
Created February 24, 2013 16:34
Unofficial We Are Hunted API (Used by their Spotify app)

Unofficial We Hunted API

I believe there used to be an official API however all the docs seems to of vanished so...

This API is used by the We Are Hunted Spotify App thus pretty stable. Reverse Engineered by @bencevans. Usage isn't to bring any harm to We Are Hunted, just for educational purposes obviously!

Formats

JSON

@LeaVerou
LeaVerou / dabblet.css
Created February 26, 2013 08:57
CSSConf gradient
/* CSSConf gradient */
height: 100%;
background-color: #96cd23;
background-image: radial-gradient(hsla(330, 50%, 60%,0) 64%, #c69 66%, #c69 75%, hsla(330, 50%, 60%,0) 77%, hsla(48, 100%, 50%,0) 90%, #fc0 92%),
radial-gradient(hsla(330, 50%, 60%,0) 64%, #c69 66%, #c69 75%, hsla(330, 50%, 60%,0) 77%, hsla(48, 100%, 50%,0) 90%, #fc0 92%);
background-size: 100px 100px;
background-position: 0 0, 50px 50px;
@xhochy
xhochy / Proposal.md
Last active December 16, 2015 02:49
Control API and Tomahawk Apps

Tomahawk Apps

  • Integrate the same concept as Spotify Apps, but a bit more flexible (not only Apps, but more of a plugin-system)
  • HTML5+JavaScript
  • QWebkit View inside Tomahawk
  • Can have an entry in the TreeView on the left side in "Apps -> " and declare subentries
  • Add addtional functionality such as: ** Custom sharing ** Charts
@bencevans
bencevans / build.sh
Last active December 17, 2015 07:19
Ubuntu 13.04 Tomahawk Build
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:tomahawk
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y libechonest-dev libfftw3-dev libsamplerate0-dev libgsasl7-dev subversion build-essential cmake libtag1c2a libtag1-dev libqt5-dev libqt5-sql-sqlite \
libphonon-dev libboost-dev libboost-thread-dev zlib1g-dev libgnutls-dev libz-dev \
libqjson-dev libattica-dev libqca2-dev libx11-dev pkg-config libqca2-plugin-ossl git-core libspeex-dev # phonon-backend-vlc
cd ~
@thinktainer
thinktainer / git_log.sh
Created May 26, 2013 10:20
nice graph for git log
git log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
@LeaVerou
LeaVerou / dabblet.css
Created June 11, 2013 16:18
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
padding-top: 50px;
}
div {
width: 100px; height: 100px;