This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') { | |
header('HTTP/1.1 301 Moved Permanently'); | |
header('Location: http://www.'.$_SERVER['HTTP_HOST'] | |
.$_SERVER['REQUEST_URI']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDistance(lon1, lat1, lon2, lat2) { | |
var R = 6371; // Radius of the earth in km | |
var dLat = toRad(lat2-lat1); | |
var dLon = toRad(lon2-lon1); | |
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + | |
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * | |
Math.sin(dLon/2) * Math.sin(dLon/2); | |
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); | |
return R * c; // Distance in km | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<title>JS Bin</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var edit = document.getElementById('editableList'); | |
$(edit).blur(function() { | |
localStorage.setItem('toDoData', this.innerHTML); | |
}); | |
//when the page loads | |
if(localStorage.getItem('toDoData')){ | |
edit.innerHTML = localStorage.getItem('toDoData'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this in doc ready | |
$(function() | |
{ | |
$('input[type=radio]').each(function() | |
{ | |
var state = JSON.parse( localStorage.getItem('radio_' + $(this).attr('id')) ); | |
if (state) this.checked = state.checked; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application: you-app-name-here | |
version: 1 | |
runtime: python | |
api_version: 1 | |
default_expiration: "30d" | |
handlers: | |
- url: /(.*\.(appcache|manifest)) | |
mime_type: text/cache-manifest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sort by price high to low | |
//homes.sort(sort_by('price', true, parseInt)); | |
var sort_by = function(field, reverse, primer){ | |
var key = function (x) {return primer ? primer(x[field]) : x[field]}; | |
return function (a,b) { | |
var A = key(a), B = key(b); | |
return ((A < B) ? -1 : | |
(A > B) ? +1 : 0) * [-1,1][+!!reverse]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getParameterByName(url, name) { | |
var match = RegExp('[?&]' + name + '=([^&]*)').exec(url); | |
return match?decodeURIComponent(match[1].replace(/\+/g, ' ')):null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<meta name="viewport" content="initial-scale=1.0, width=device-width, height=device-height, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<link rel="apple-touch-icon-precomposed" href="maps-icon.png"/> | |
<link rel="apple-touch-startup-image" href="splash.png" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.spotifyLink = (tracks) -> | |
extractID = (track) -> | |
track.replace(/spotify.track./,"") | |
"spotify:trackset:Title:#{extractID(track) for track in tracks}" | |
window.playlistLink = (tracks) -> | |
"<b><a href='#{spotifyLink(tracks)}'>Spotify playlist</a></b> | |
<small>Found #{tracks.length}/#{HUNTED.chart.entities.length}</small> | |
" |