Skip to content

Instantly share code, notes, and snippets.

View johnie's full-sized avatar
♿
httpster

Johnie Hjelm johnie

♿
httpster
View GitHub Profile
@johnie
johnie / bayern.json
Created August 8, 2014 20:49
Bayern München Game Schedule 2014/15
{
"data": {
"team": "Bayern München",
"season": "2014/15",
"squad": [
{"tee": 1, "name": "Manuel Neuer", "position": "GK"},
{"tee": 22, "name": "Tom Starke", "position": "GK"},
{"tee": 4, "name": "Dante", "position": "DF"},
{"tee": 13, "name": "Rafinha", "position": "DF"},
{"tee": 17, "name": "Jérôme Boateng", "position": "DF"},
@johnie
johnie / getUrlParam
Last active August 29, 2015 14:05
Quickly find a param in url with location.search
function $_GET(q,s) {
s = (s) ? s : window.location.search;
var re = new RegExp('&'+q+'=([^&]*)','i');
return (s=s.replace(/^\?/,'&').match(re)) ?s=s[1] :s='';
}
@johnie
johnie / chelsea.json
Created August 24, 2014 11:42
Chelsea Game Schedule 2014/15
{
"data": {
"team": "Chelsea",
"season": "2014/15",
"squad": [
{"tee": 1, "name": "Petr Čech", "position": "GK"},
{"tee": 23, "name": "Mark Schwarzer", "position": "GK"},
{"tee": 46, "name": "Jamal Blackman", "position": "GK"},
{"tee": 13, "name": "Thibaut Courtois", "position": "GK"},
{"tee": 2, "name": "Branislav Ivanović", "position": "DF"},
@johnie
johnie / drupal-npm.md
Last active August 29, 2015 14:08
Fix issue with running Gulp in Drupal

Add this to package.json

"scripts": {
  "prepublish": "find node_modules -name '*.info' -exec rm -f {} \\;"
}
@johnie
johnie / wgetsite.sh
Last active August 29, 2015 14:12
Download website with wget
#!/bin/bash
if [ -z "$1" ]
then
echo "Which website would like to download?"
exit 1
fi
wget \
--recursive \
@johnie
johnie / fabfile.py
Created January 11, 2015 20:37
Simple Fabric deploy
from __future__ import with_statement
import os.path
from fabric.api import *
from fabric.contrib.project import *
"""
Environments
"""
@johnie
johnie / browsealoud.js
Created January 13, 2015 13:33
browsealoud.js
var $bajq, domUrl, browsealoud = {
CAPTURE_ANALYTICS: false,
BASE_ADDRESS: "babm.texthelp.com",
URL_INFO_ADDRESS: "babm.texthelp.com",
COOKIE_NAME: "__ba_plus",
ELEMENT_PREFIX: "_ba_",
GA_PROPERTY_ID: "UA-4669579-7",
LIGHTBOX_WIDTH: 450,
LIGHTBOX_HEIGHT: 160,
LANG_MAP: [{
@johnie
johnie / app.js
Created January 23, 2015 19:51
Setting up express and nunjucks with custom views folder
/*----------------------------------------------------------*\
Setting up express and nunjucks with custom views folder
\*----------------------------------------------------------*/
var express = require('express');
var app = express();
var nunjucks = require('nunjucks');
var path = require('path');
@johnie
johnie / computedstyle.js
Created April 8, 2015 11:42
Get computed style
function _getComputedStyle(element){
var style,
_element = element;
while(_element && _element.nodeType !== 1){
_element = _element.parentNode;
}
style = _element && _element.nodeType == 1 ? window.getComputedStyle(_element) : null;
return style;

Keybase proof

I hereby claim:

  • I am johnie on github.
  • I am johnie (https://keybase.io/johnie) on keybase.
  • I have a public key whose fingerprint is A42B C411 5BAC 7FE1 5728 150A A84A 4594 6E00 E128

To claim this, I am signing this object: