Skip to content

Instantly share code, notes, and snippets.

View letsgetrandy's full-sized avatar

Randy letsgetrandy

View GitHub Profile
@letsgetrandy
letsgetrandy / index.html
Created February 20, 2013 18:13
another day at the office
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg);">
<scene id="scene1">
<label t="translate(0,346)">
@letsgetrandy
letsgetrandy / index.html
Created February 20, 2013 18:53
Katie making a joke...
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg);">
<scene id="scene1" height="280">
<drawing t="translate(0,31)">
@letsgetrandy
letsgetrandy / foia.php
Created March 21, 2013 19:30
A joke plugin for Wordpress that redacts random parts of your content before it is displayed, just like on a government document.
<?php
/*
Plugin Name: Freedom of Information?
Plugin URI: http://www.bbqiguana.com/tag/wordpress-plugins/
Version: 0.2
Description: A fun plugin that redacts random parts of your content before it is displayed, just like a government document.
Author: Randy Hunt
Author URI: http://www.bbqiguana.com/
*/
@letsgetrandy
letsgetrandy / pnkeynav.php
Created March 21, 2013 19:37
Wordpress plugin to enable J/K keys for navigating posts.
jQuery(function() {
if (jQuery('.post').length < 2) return;
jQuery(document).keypress(function(e) {
var f=false, b=false;
if (e.target.tagName.match(/input|textarea/i)) return;
switch (e.which) {
case 75:
case 107:
b=true;
break;
@letsgetrandy
letsgetrandy / crossposterous.php
Created March 21, 2013 20:20
Wordpress plugin to crosspost to Posterous blogs.
<?php
/*
Plugin Name: Crossposterous
Plugin URI: http://www.bbqiguana.com/wordpress-plugins/crossposterous/
Description: This plugin will automatically cross-post your Wordpress blog entry to your Posterous site.
Version: 1.2.1
Author: Randy Hunt
Author URI: http://www.bbqiguana.com/
*/
@letsgetrandy
letsgetrandy / .vimrc
Created March 21, 2013 20:23
My .vimrc file
filetype plugin on
filetype indent on
set ruler
set noerrorbells
set showmatch
set autoread
set ignorecase
set smartcase
@letsgetrandy
letsgetrandy / render.js
Last active April 14, 2018 19:04
Simple template rendering for Javascript
/* Simple JS template rendering function */
function render(obj, template) {
var re, v;
re = new RegExp("\\[\\[([^\\]]+)\\]\\]");
while (match = re.exec(template)) {
val = obj[match[1]] || '';
template = template.replace(match[0], val);
}
return template;
}
@letsgetrandy
letsgetrandy / eventcmd
Created April 6, 2013 20:17
event_command script for mcabber
#! /usr/bin/python
'''
EVENTCMD -
This script is meant to respond to external 'eventcmd' calls from
the mcabber command-line jabber client.
'''
import sys
import re
from os import remove, system
@letsgetrandy
letsgetrandy / cssgrep
Last active December 17, 2015 05:49
A handy way to search HTML files for any instances of a particular CSS class name.
#!/bin/bash
#
# Searches all HTML files and matches those where a
# particular CSS class name is used
if command -v ag >/dev/null 2>&1
then
# use silver-searcher if available
ag -G "\\.html$" "class=\"[^\"]*\\b$1\\b[^\"]*\""
elif command -v ack >/dev/null 2>&1
@letsgetrandy
letsgetrandy / orphan
Last active November 19, 2021 19:11
Bash script for finding and deleting orphaned files. Works best with the Silver Searcher (https://github.com/ggreer/the_silver_searcher). Works well with ack (http://beyondgrep.com/). Works okay with grep, but you're not really still using grep, are you? Using ag or ack allows you to respect your config files and ignore files you don't want to s…
#! /bin/bash
#
# USAGE:
# orphan [-dv] filename
#
# OPTIONS:
# -d delete the file if it is an orphan
# -f force (ie, don't prompt)
# -h display help text
# -v verbose