Skip to content

Instantly share code, notes, and snippets.

@calvinf
calvinf / image_swap.js
Created May 7, 2009 20:40
javascript image swapper, for use with rollover image replacements
function swapimage(elem_id, img_src) {
document.getElementById(elem_id).src = img_src;
}
@calvinf
calvinf / wordpress_get_plugins.pl
Created February 1, 2010 23:10
Get WordPress plugins from SVN
#!/usr/bin/perl
use strict;
use constant PLUGIN_DIR => 'http://svn.wp-plugins.org/';
#argument 1 should be file name with 1 plugin slug per line
while(<>) {
chomp;
checkout($_);
}
@calvinf
calvinf / .alacritty.yml
Last active February 20, 2021 17:10
calvinf's .bash_profile
# Configuration for Alacritty, the GPU enhanced terminal emulator.
# https://github.com/alacritty/alacritty
import:
# https://github.com/dracula/alacritty
- ./.dracula.yml
window:
# Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons
@calvinf
calvinf / jquery.myplugin.js
Created July 8, 2010 21:08
jQuery Plugin Stub
;(function($) {
$.fn.myPlugin = function(options) {
var defaults = {
};
var options = $.extend(defaults, options);
function log(message) { /* debug function */
if (console && console.log) {
@calvinf
calvinf / find_perl_modules.sh
Created November 24, 2010 22:31
Find All Perl Modules
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \
'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
@calvinf
calvinf / .tcshrc
Created December 8, 2010 19:12
TCSH Shell Configuration
# keyboard bindings: http://www.ibb.net/~anne/keyboard/keyboard.html
if ($term == "xterm" || $term == "vt100" \
|| $term == "vt102" || $term !~ "con*") then
# bind keypad keys for console, vt100, vt102, xterm
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode # Ins
bindkey "\e[3~" delete-char # Delete
bindkey "\e[4~" end-of-line # End
bindkey "\e[8~" end-of-line # End rxvt
@calvinf
calvinf / WordCountTestCase.js
Created December 10, 2010 08:53
Utility Functions, a Test Class, and test cases for counting words in input text
/*
* WordCountTestCase Class
* Expects: paragraph, integer for expected count, array of expected words, and a test name
* returns boolean, test results logged to console
*/
function WordCountTestCase(paragraph, expectedCount, expectedWords, testName) {
this.testName = testName || 'Test';
this.paragraph = paragraph;
this.expectedCount = expectedCount;
this.expectedWords = expectedWords;
//for additional examples, see: http://www.stevesouders.com/p3pc/
var theOtherScript = 'http://example.com/js/script.js';
var el = document.createElement('script');
el.async = false;
el.src = theOtherScript;
el.type = 'text/javascript';
(document.getElementsByTagName('HEAD')[0]||document.body).appendChild(el);
@calvinf
calvinf / .vimrc
Last active February 25, 2021 07:18
.vimrc file
" Enable pathogen
call pathogen#infect()
" Standard Vim settings
filetype on
filetype indent on
filetype plugin on
syntax on
@calvinf
calvinf / cssUrlSearch.sh
Created June 8, 2011 01:00
Search CSS files for every background-image URL and output unique URLs in a list
ack -o -h --nogroup --css 'url\((.*)\)' --output "\$1" | ack -o "^['\"](.*)['\"]$" --output "\$1" --passthru | sort -u