Skip to content

Instantly share code, notes, and snippets.

🥝
/shrug

Luke Hedger lukehedger

🥝
/shrug
Block or report user

Report or block lukehedger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lukehedger
lukehedger / absoluteValues.xsl
Created Jul 3, 2012
XSL - Format numbers as absolute values
View absoluteValues.xsl
<!-- Formatting a number with '#.##;#.##' will return the absolute value -->
<xsl:variable name="absoluteValue" select="format-number($originalValue,'#.##;#.##')"/>
@lukehedger
lukehedger / showFeed.xml
Created Jul 3, 2012
XML - Show full feed on page
View showFeed.xml
<!-- Textarea can be resized as required. Its just used to contain the feed -->
<textarea cols='150' rows='30'><xsl:copy-of select='/'/></textarea>
@lukehedger
lukehedger / Slidershow.js
Created Jul 25, 2012
JS - Use the jQuery Slider control to create an interactive slideshow
View Slidershow.js
//master function to hold all actions on slider
//HTML - you'll need an empty div with id=slider to hold the initiated control
$(function() {
$( "#slider" ).slider({
value:1, //start pos
min: 1,
max: 7, //number of slides
step: 1,
animate: true,
change: function( event, ui ) { //run function each time the slider is used
View nodejitsu-error
info: Creating snapshot 0.0.1-1
info Uploading: [=============================] 100%
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
help: For help with this error contact Nodejitsu Support:
help: webchat: <http://webchat.nodejitsu.com/>
help: irc: <irc://chat.freenode.net/#nodejitsu>
help: email: <support@nodejitsu.com>
help:
help: Copy and paste this output to a gist (http://gist.github.com/)
@lukehedger
lukehedger / arrayFilter.coffee
Last active Dec 27, 2015
CoffeeScript Array.filter
View arrayFilter.coffee
array = [
{
"id":"1",
"type":"a"
},
{
"id":"2",
"type":"b"
}
]
@lukehedger
lukehedger / randomNumber.coffee
Last active Jul 17, 2016
CoffeeScript random number generator
View randomNumber.coffee
_randomNum: (max,min=0) ->
return Math.floor(Math.random() * (max - min) + min)
# min is set to 0 by default but a different value can be passed to function
_randomise: ->
randomNum = @_randomNum(10)
# returns a random integer between 0 and 10
@lukehedger
lukehedger / arraySort.coffee
Created Nov 11, 2013
CoffeeScript Array.sort
View arraySort.coffee
array = [
{
"id":"1",
"type":"z"
},
{
"id":"2",
"type":"a"
}
]
@lukehedger
lukehedger / iframeCheck.coffee
Last active Dec 30, 2015
Check for parent window/iframe
View iframeCheck.coffee
# check if page loaded within iframe
if window.parent != window
console.log 'within iframe'
# access properties from the parent window object
orientation = window.parent.orientation
else
console.log 'no iframe'
# access properties from the window object as normal
orientation = window.orientation
@lukehedger
lukehedger / MinMax.coffee
Created Dec 10, 2013
MinMax helper class in CoffeeScript
View MinMax.coffee
class MinMax
@min: (array) -> Math.min.apply Math, array
@max: (array) -> Math.max.apply Math, array
# Use...
min = MinMax.min [0,1,2]
max = MinMax.max [5,4,3]
@lukehedger
lukehedger / scrollTo.coffee
Created Dec 17, 2013
Animated ScrollTo element
View scrollTo.coffee
_addListeners: ->
$(document).on 'click', '.scrollTo', @_onScrollToClick
# where <a id="#element"> corresponds to <div id="element">
_onScrollToClick: ->
id = $(this).attr 'id'
$('html,body').animate {scrollTop: $(id).offset().top},400
You can’t perform that action at this time.