Skip to content

Instantly share code, notes, and snippets.

View balupton's full-sized avatar
🏍️
Travelling for next 2 weeks

Benjamin Lupton balupton

🏍️
Travelling for next 2 weeks
View GitHub Profile
@balupton
balupton / README.md
Last active September 25, 2015 00:48
Jekyll Projects Plugin Usage
@balupton
balupton / README.md
Last active September 25, 2015 01:08
Aloha UI Abstraction
@balupton
balupton / main.rb
Last active September 25, 2015 01:27 — forked from Jarla/gist:840182
Aloha Editor's Command Line Interface. Attempt #2
#!/usr/bin/env ruby
# == Name
# cli - Aloha Editor's Command Line Interface
#
# == Synopsis
# Refer to the README file for usage
#
# == Options
# -h, --help Displays help message
@balupton
balupton / main.rb
Last active September 25, 2015 01:57
Aloha Editor's Command Line Interface. Attempt #3
#!/usr/bin/env ruby
# == Name
# cli - Aloha Editor's Command Line Interface
#
# == Synopsis
# Refer to the README file for usage
#
# == Options
# -h, --help Displays help message
@balupton
balupton / README.md
Last active April 20, 2022 13:21
Ajaxify a Website with the HTML5 History API using History.js, jQuery and ScrollTo
@balupton
balupton / ajaxify.php
Created March 7, 2011 04:56
Ajaxify a Website with Server Side Optimisations
<?php
// Our Page Action
public function pageAction ( ) {
// Prepare our variables for our view
// ...
// Handle our view
return $this->awesomeRender('page.html');
}
@balupton
balupton / ajaxify-html4.js
Created March 7, 2011 04:58
Ajaxify a Website using the HTML4 HashChange Functionality
(function(window,undefined){
// Prepare our Variables
var
document = window.document,
$ = window.jQuery;
// Wait for Document
$(window).bind(function(){
// Prepare Variables
@balupton
balupton / safari-hash-replacestate-history-traversal-bug.html
Created March 12, 2011 14:13
Demonstrates an issue with Safari 5 and its handling of hashes with replaceState.
<html>
<head>
<title>Safari Hash ReplaceState History Traversal Bug</title>
</head>
<body>
<p>This demo demonstrates an issue with Safari 5.0.4 (6533.20.27) handing of hashes and replace state. When a hash is set, and then replaced using replaceState the history list are then broken, when traversing back the hash does not change.</p>
<p>Note: The issue requires a clean history list, as such this should always be opened in a new tab/window where there are no prior history items.</p>
<p>Reported by <a href="http://balupton.com">Benjamin Lupton</a> author of <a href="http://github.com/balupton/history.js">History.js</a></p>
<button id="bug">bug</button>
<button id="workaround">workaround</button>
@balupton
balupton / bookmark-helper.js
Last active December 6, 2017 05:38
History.js It! A bookmark for trialing History.js on your own website.
(function(window,undefined){
// Load Helpers
var
intervalScript, intervalJquery,
loadScript = function(scriptUrl){
var e = document.createElement('script');
e.setAttribute('src',scriptUrl);
window.document.body.appendChild(e);
return e;
@balupton
balupton / nowsecure.js
Created April 25, 2011 18:16
In regards to the security and serialisation discussion for Now.js
// Counter Store for Original Functions
var originalFunctions = {}, originalFunctionCounter = 0;
// Secure a Client to Server Object
var serialise = function(args){
// Prepare
var
functionKeys = {},
result = {},
functionAlias = function(){