Skip to content

Instantly share code, notes, and snippets.

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

Luke Hedger lukehedger

🍵
(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू)
View GitHub Profile
@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 / kill-jekyll.md
Last active February 28, 2022 16:57
Kill Jekyll server

Stopping a Jekyll server with ctrl-z can cause issues as the process is not stopped fully. To kill it:

$ lsof -wni tcp:4000
$ kill -9 <PID of process>

And next time, use crtl-c to stop.

@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
@lukehedger
lukehedger / scanDir.php
Created July 1, 2014 14:53
PHP directory scan
<?php
header('Content-Type: application/json');
function scan(){
$dirOne = scandir('../data/one');
$dirTwo = scandir('../data/two');
$response = (object) array('dirOne' => $dirOne, 'dirTwo' => $dirTwo);
@lukehedger
lukehedger / mkdircd.bash
Created July 9, 2014 08:46
mkdir and cd into it
$ mkdir newdir && cd $_
@lukehedger
lukehedger / import.html
Last active August 29, 2015 14:04
HTML Imports/Templates example
<html>
<head>
<!-- Link to import file -->
<link rel="import" href="template.html" name="template1">
</head>
<body>
<!-- a container div with an id to match the name attribute of the import link -->
<div class="container" id="template1">
<!-- the contents of template.html will be inserted here at runtime -->
@lukehedger
lukehedger / xhr.js
Created July 29, 2014 08:46
XMLHttpRequest
request = new XMLHttpRequest();
request.open('GET', '/data/data.json', true);
request.onload = function() {
if (this.status >= 200 && this.status < 400){
data = JSON.parse(this.response);
console.log(data);
} else {
console.log("Data error");
}