Skip to content

Instantly share code, notes, and snippets.

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

Luke Hedger lukehedger

🍵
(ू˃̣̣̣̣̣̣︿˂̣̣̣̣̣̣ ू)
View GitHub Profile
@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 / 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 / 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 / obj.php
Created March 20, 2014 12:13
Quick object in PHP
$obj = (object) array('prop' => value, 'prop' => $var);
@lukehedger
lukehedger / setTimeout.coffee
Created February 27, 2014 10:10
CoffeeScript setTimeout
setTimeout =>
@_delayedFunc()
,1000
@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 / browserBorder.css
Created January 22, 2014 14:56
Border around browser viewport - with scrollbars inside
.page-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 700; /* must be the higher than all other elements */
overflow: auto; /* moves scrollbars inside border */
background: #fff;
border: 5px solid #ff9900;
@lukehedger
lukehedger / gWebFont.css
Last active August 14, 2023 13:36
Stylus + Google Web Fonts
/* Here's the compiled CSS */
@import url("http://fonts.googleapis.com/css?family=Droid+Sans");
body {
font-family: Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 25px;
font-weight: 300;
color: #444;
}
@lukehedger
lukehedger / showHiddenFiles
Created January 6, 2014 15:35
Show hidden files on Mac OSX
# show
$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder
# hide
$ defaults write com.apple.finder AppleShowAllFiles FALSE