Skip to content

Instantly share code, notes, and snippets.


Jonathan M. Hollin PerpetualBeta

View GitHub Profile
PerpetualBeta / gist:4009338
Created Nov 3, 2012
Adds a "fuzzy" search suggestion to the i18n_search plug-in for the GetSimple CMS
View gist:4009338
* Fuzzy Search Suggestion Snippet for i18n_search plug-in for the GetSimple CMS
* Sometimes a search query produces no matches. This is occassionaly due to a
* miss-spelling in the query terms. This routine will attempt to offer a search
* suggestion to the user when a search results in no matches.
* For example:
PerpetualBeta / ticker.js
Created Oct 27, 2012
Compact, vertical, infinite ticker/scroller. Pauses on "mouseenter" event.
View ticker.js
(function ($) {
$.fn.ticker = function (options) {
var defaults = {
speed: 1000,
pause: 3000,
p: false
options = $.extend(defaults, options);
PerpetualBeta / daySensitiveCountdownTimer.js
Last active Jan 7, 2019
A real-time countdown timer for a web page. Will countdown to a target time, but only on days specified (eg: Mon-Fri).
View daySensitiveCountdownTimer.js
if (document.getElementById('countdownTimer')) {
pad = function(n, len) { // leading 0's
var s = n.toString();
return (new Array( (len - s.length + 1) ).join('0')) + s;
var timerRunning = setInterval(
function countDown() {
var now = new Date();
if ( (now.getDay() >= 1) && (now.getDay() <= 5) ) { // Monday to Friday only
PerpetualBeta / tinyImgCycle.js
Created Oct 27, 2012
Cycle through a series of images. Fade transition between slides. Loops back to first slide at end of collection.
View tinyImgCycle.js
// Requires the jQuery library -
// Demo:
function slideshow(){var a=$("#animation");a.length==0&&(a=$("#animation img:last"));var$("#animation img:first");a.addClass("last-active");b.css({opacity:0}).addClass("active").animate({opacity:1},1E3,function(){a.removeClass("active last-active")})}$(function(){setInterval("slideshow()",5E3)});
PerpetualBeta / gist:3964029
Created Oct 27, 2012
Rename all files in a directory to their web-safe equivalents.
View gist:3964029
perl -e 'foreach $file (glob "*") { $dest_file = $file; $dest_file =~ s/ /_/sg; $dest_file =~ s/[^a-zA-Z_\-.0-9]//sg; rename $file, lc($dest_file) }'
PerpetualBeta / web-page-envelope.php
Created Oct 25, 2012
PHP wrapper for servers where mod_expires and/or mod_deflate are not available. Files routed through this wrapper will be served gzip-compressed, with an ETag and with a "far future expires" header.
View web-page-envelope.php
* Page delivery wrapper for servers where mod_expires and/or mod_deflate are
* not available.
* Route page requests through this wrapper (via mod_rewrite for example) and
* they will be served with far future expires, etags and will be gzip
* compressed.