Skip to content

Instantly share code, notes, and snippets.

View volomike's full-sized avatar

Mike McKee volomike

View GitHub Profile
@volomike
volomike / localdate.js
Created January 2, 2021 01:00
Minimalist jQuery Local Date/Time Script Without Moment.js
$(document).ready(function(){
// Convert RFC2822 date/time string to local date/time in format MM/DD/YYYY HH:MM XM.
// Note that PHP has a date format of 'r' that generates RFC2822 format.
// Wrap your RFC2822 HTML element with the localdate class and this function converts it.
$('.localdate').each(function(){
var o = $(this);
var d = new Date(o.text());
var s = d.toLocaleString();
s = s.replace(/(?<!\d)(\d)(?!\d)/g,'0$1');
@volomike
volomike / xyzzy
Last active May 30, 2016 01:14
xyzzy - Great system admin command for Bash for switching between directories
#!/bin/bash
i="$1"
i=$((${i//[^0-9]/}))
i="$(($i-1+0))"
b="$2"
b=$((${b//[^0-9]/}))
b="$(($b-1+0))"