Skip to content

Instantly share code, notes, and snippets.

View lukehedger's full-sized avatar
🍵
(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू)

Luke Hedger lukehedger

🍵
(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू)
View GitHub Profile
@lukehedger
lukehedger / law-permissions.sh
Created August 27, 2015 14:42
Nail permissions on Law
$ ll
$ sudo chown -R hub_bot:www-data .
$ sudo chmod -R 755 .
@lukehedger
lukehedger / convertRoundMiles.coffee
Created February 18, 2014 17:39
Convert KM to Miles and round to 1 dp
distanceKM = 100
distanceMiles = distanceKM / 0.6 # => 166.66667
distanceMilesRounded = parseFloat(distanceMiles, 10).toFixed 1 # => 166.7
@lukehedger
lukehedger / requireNonAMD.js
Created February 18, 2014 12:13
RequireJS with non-AMD modules
// 1. Add definition to foot of module.js (the required file)
// AMD Define
define(function(){
return baron;
});
// 2. Add the path to main.js (requireJS config) as normal
require.config({
baseUrl: "/sites/all/themes/base/js/",
@lukehedger
lukehedger / setTimeout.coffee
Created February 27, 2014 10:10
CoffeeScript setTimeout
setTimeout =>
@_delayedFunc()
,1000
@lukehedger
lukehedger / obj.php
Created March 20, 2014 12:13
Quick object in PHP
$obj = (object) array('prop' => value, 'prop' => $var);
@lukehedger
lukehedger / textOverflow.css
Created March 28, 2014 12:08
Text overflow ellipsis
.overflowing-text {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
@lukehedger
lukehedger / FlashDetect.coffee
Created May 12, 2014 17:01
Detect Flash support
detectFlash: ->
if navigator.plugins["Shockwave Flash"]
return true
return false
# usage:
# if detectFlash()
# console.log "Flash supported"
# else
@lukehedger
lukehedger / htaccess-extension-remover
Created June 5, 2014 16:07
Remove URL file extensions using .htaccess
# ----------------------------------------------
# Quick method:
# ----------------------------------------------
Options +MultiViews
# With Apache MultiViews, the server will look for files that match the requested resource (eg. a request for "site.com/page" will serve "site.com/page.php")
# ----------------------------------------------
# Long method:
@lukehedger
lukehedger / OO.js
Created June 24, 2014 11:46
Skeleton object-orientated JS
var app = new App('arg');
App = function(arg) {
this.APP_CONSTANT = 0;
this.appVar = arg;
this._init();
}
@lukehedger
lukehedger / pythonServer.bash
Created June 27, 2014 10:45
Python SimpleHTTPServer
$ python -m SimpleHTTPServer 8000