Geeky Stuff

Here you’ll find articles, tutorials, configuration files, scripts, and source code related to computers and the Web. All source code is released under the GNU General Public License (GPL). If you don’t find what you’re looking for here, you might try my friend Jem’s site, Tutorialtastic.

Web Development

Articles

  • regular Javascript v. AJAX for dynamic content insertion27 Feb 08

    “Recently for work, I’ve had cause to write functionality so that a certain chunk of a form can be inserted again, over and over, by the user. The form involves data about course equivalencies between…”

  • using Javascript and CSS to mark outgoing links26 Sep 07

    “It may be useful to your visitors to know which links will take them off of your site without having to hover over all of them. It might also be a nice touch to mark links pointing to PDF documents,…”

  • using AJAX to spiff up a gallery3 May 07

    “Lightbox is nice and all, but sometimes I find it clunky, particularly in Firefox when I have a lot of other tabs open. However, I don’t want to go the route of having an image load by itself in the…”

  • how to be a snobby web designer30 Mar 07

    “I’m not talking about the attitude that comes across in your writing, but instead how you design your pages. I’ve seen these problems crop up from time to time on various sites and it always bugs me,…”

  • using Perl and Apache on OS X22 Mar 07

    “What was this /private/etc/httpd/users/sarah.conf that it was talking about? I had never created this file. I checked and it certainly existed. It also had an Options line without ExecCGI–bingo! I simply removed the file because it was just redefining what I had already specified in httpd.conf for Users/*/Site directories (shown above). I then restarted Apache and voila, my scripts worked.”

  • custom shapes in Photoshop3 Aug 06

    “Custom shapes can be very useful for making multiple objects that look the same. For example, say you want several photos to all be cut out of the same shape, like this:

    Creating a Custom Shape…”

  • Clichés of a Crappy Site23 Dec 05

    “If you’ve browsed through many personal sites at all, you’ve probably seen some of the following things that make me personally cringe. I don’t understand why they’re so trendy, since they don’t impr…”

  • simple photo gallery script21 Jul 05

    “A very simple photo gallery tool. It displays a set of thumbnail images (made by you) and then each individual image when clicked.

    Requirements

    You need PHP support on your server. An easy wa…”

  • why I love my CMS14 Jul 05

    “For many years (most of my web designing history, really), I maintained all my pages myself with only an HTML editor and scp for uploading. I saw many other sites that used tools like WordPress, Mova…”

  • neat code23 Jun 05

    “One of the easiest ways to keep your code easy to update, read, and debug is to keep it neat. That means indentation, documentation, consistency, and logic need to be applied. These are basics in an…”

  • steal my code!23 Jun 05

    “I was just reading a review that said:
    “So many webmaster/mistresses on the web are so afraid of having their code stolen. Does it really matter?” yes, I think it does matter. Particularly for pe…”

  • the alt attribute6 Jan 05

    “Each time that you use <img> or <area>, you should include the alt attribute. An alt attribute is generally a short description of what the <img> or <area> contains or is pert…”

Presentations

I’ve had to do a couple of presentations over the years to inform others about web design topics, and I figured you guys might benefit from them as well. Please do not replicate these elsewhere or attempt to edit them, claiming them as your own.

CSS presentation thumbnail
View PDF »
This lasted about an hour, if I remember correctly, and skimmed over HTML and CSS basics before delving into guidelines for improving a web page’s appearance through CSS. The audience was my fellow college students who may have had some knowledge of HTML and CSS, but no background in professional web design.
Intro. to web design presentation thumbnail
View PDF »
This is a very basic introduction on how to go about creating a web page. It was to last for about ten minutes and given to an audience of middle schoolers. See also the handout I made for them containing links to various resources.

Programming

C++

I don’t particularly like C++, but I’ve had to use it for various classes and also in a programming job I had. I figure it’s a good language to know, but it’s never my first choice when writing a program.

  • C++ shell with forks and pipes29 Nov 08

    “As an assignment for my operating systems class, we were to write a shell in C or C++. I’m putting my work here under the GNU General Public License v3 in hopes that it will be helpful for someone else, presumably some future student arguing with the C language, which I find infinitely frustrating to work with sometimes.”

  • enqueue and dequeue15 Nov 05

    “Source for enqueue() and dequeue() functions to add and remove data from a queue in a class.

    Node Struct Definition
    struct node {
    string what; // Used for brand
    string serialNumber;…”

  • Makefile15 Nov 05

    “In a Unix environment when working with C++ or C, a Makefile can be a very handy thing. Instead of typing several separate commands each time you update a file and want to recompile, you can just typ…”

Javascript

I’ve gone from hating Javascript to really enjoying it. When used correctly, it can add a lot to a site, and I enjoy working with it.

  • regular Javascript v. AJAX for dynamic content insertion27 Feb 08

    “Recently for work, I’ve had cause to write functionality so that a certain chunk of a form can be inserted again, over and over, by the user. The form involves data about course equivalencies between…”

  • using Javascript and CSS to mark outgoing links26 Sep 07

    “It may be useful to your visitors to know which links will take them off of your site without having to hover over all of them. It might also be a nice touch to mark links pointing to PDF documents,…”

  • using AJAX to implement a live search14 May 07

    “I recently implemented a live search on the quotes page, so I figured I’d give a tutorial on how I did it. A “live” search is like a regular search feature, but if the user has Javascript enabled, th…”

  • using AJAX to spiff up a gallery3 May 07

    “Lightbox is nice and all, but sometimes I find it clunky, particularly in Firefox when I have a lot of other tabs open. However, I don’t want to go the route of having an image load by itself in the…”

PHP

PHP is the first language I really loved, because it just seems like the perfect generic language. It’s very comfortable and easy to work with.

  • my Qbee PHP script21 Mar 08

    “I’m a member of the Quilting Bee and I use a very simple PHP script I wrote for displaying my quilt. I figure someone else might get some use out of it, so here it is for your coding pleasure:…”

  • using AJAX to implement a live search14 May 07

    “I recently implemented a live search on the quotes page, so I figured I’d give a tutorial on how I did it. A “live” search is like a regular search feature, but if the user has Javascript enabled, th…”

  • using AJAX to spiff up a gallery3 May 07

    “Lightbox is nice and all, but sometimes I find it clunky, particularly in Firefox when I have a lot of other tabs open. However, I don’t want to go the route of having an image load by itself in the…”

  • image generation in PHP11 Mar 06

    “Creating images on-the-fly can be a very useful skill. Using PHP’s built-in image generation functions, it’s pretty easy, too. This tutorial will detail how to have the titles of blog entries show u…”

  • simple photo gallery script21 Jul 05

    “A very simple photo gallery tool. It displays a set of thumbnail images (made by you) and then each individual image when clicked.

    Requirements

    You need PHP support on your server. An easy wa…”

  • random quotes with PHP8 Jun 05

    “So you want to display a randomly selected quote on your page, and you want to use PHP to do it. It’s dang simple, let me tell you.

    RequirementsYou need PHP support on your server. An easy way to…”

  • more dynamic sites through PHP8 Jun 05

    “A couple of reasons to use PHP in your site:
    Separation of content from design–when you want to change the look of your page, you can update a few files and every page of your content will be update…”

Perl

I must admit, Perl kinda scares me. It’s like the 1337 language of über geeks, and I worry that I don’t grok enough to properly use it.

  • using Perl and Apache on OS X22 Mar 07

    “What was this /private/etc/httpd/users/sarah.conf that it was talking about? I had never created this file. I checked and it certainly existed. It also had an Options line without ExecCGI–bingo! I simply removed the file because it was just redefining what I had already specified in httpd.conf for Users/*/Site directories (shown above). I then restarted Apache and voila, my scripts worked.”

  • extensionChanger.pl18 Dec 05

    “This script will rename all files with one extension to another extension. Example: all files in a given directory that end with .php will be renamed to end with .txt.

    Download the program and in…”

Ruby

Ahh, Ruby. This is my absolute favorite language. It has a beauty and grace to it like I’m waxing poetic about something more than a programming language.

  • code reports Rake task7 Apr 09

    “This will run various Ruby Gems for creating code quality reports, store them in public/ in your Rails app, and create public/reports.html with links to each report. You need Saikuro, Flog, Flay, Ree…”

  • sortable arrays of symbols in Ruby7 Apr 09

    “I got this error in my Rails app because I was trying to sort an array of symbols: undefined method `’ for :my_symbol:Symbol. I defined the spaceship method for the Symbol class and included the Com…”

  • chmodding and Ruby1 Feb 08

    “Recently, I switched from a Powerbook to a Macbook, and to copy my files from one to the other, I used a pen drive. Since my pen drive has a FAT file system, it treats everything as being executable. This, however, is not the case on a UNIX-like file system like OS X. In order to save myself the hassle of manually chmodding thousands of files, I wrote this Ruby script.”

  • using Ruby to rename files and edit their content21 Nov 07

    “Recently at work, the web admin for the computer science department came into our lab and told us that my employer’s site was broken. The admin had need to make all .php files not act as PHP scripts,…”

  • finding invalid foreign keys in Rails15 Nov 07

    “Sometimes it would be useful to tell users of your Ruby on Rails application if there is a problem in the database, such as some foreign keys are invalid. As an example, let’s assume you have two mod…”

  • the many methods to #find things in Rails22 Nov 06

    “For the longest time, I didn’t understand the full power of the various #find methods in Rails. I probably still don’t, but my view of them has certainly expanded. I used to use plain ol’ #find for…”

  • #post method in tests with a different controller14 Nov 06

    “I wanted a #login method in test_helper that would allow me to easily login from any of my functional tests. However, the #post method won’t allow you to set a different controller than the one in the…”

  • go from model to associated table name and back31 Aug 06

    “Given a table object, it returns the related string object; e.g. SubAttribute => ’sub-attribute’. Useful if you want to make a list of all your tables with perhaps their fields listed out to the side….”

  • conditioner for ActiveRecord-friendly conditions from a collection31 Aug 06

    “I frequently have a collection of values that I want to match in an ActiveRecord query, but it would be nice if I could let ActiveRecord handle checking the data and escaping it properly. So, I wrote…”

  • simple Rails preference storage11 Aug 06

    “So you’ve got some Rails application and you need to store information from the users across their interactions with the app. Here’s a simple, straightforward way to do that.

    In your controller:…”

  • if succinctly7 Jun 06

    “In Ruby, if is an expression, not a statement, thus it returns a value. This may not seem useful at first glance, but it lends itself to forming neat, concise code… Like most things in Ruby, actua…”

  • the power of yield28 May 06

    “…and super. These two keywords allow you to pass control back and forth between parent and child methods, to weave power between a more general method (in the parent class) and a more specific meth…”

Linux

  • chmodding and Ruby1 Feb 08

    “Recently, I switched from a Powerbook to a Macbook, and to copy my files from one to the other, I used a pen drive. Since my pen drive has a FAT file system, it treats everything as being executable. This, however, is not the case on a UNIX-like file system like OS X. In order to save myself the hassle of manually chmodding thousands of files, I wrote this Ruby script.”

  • Grub Error 1725 Oct 07

    “I just had an interesting time with trying to boot into Linux on my PC. Last night, I noticed my /boot/grub/menu.lst file had gotten overwritten when I performed some Ubuntu updates. This meant I ha…”

  • how to reformat your pen drive19 Apr 07

    “USB pen drives are everywhere these days, and for good reason, since they’re dead useful. I use mine with my Linux box, my Powerbook, and various other systems I’ve had cause to stick it in. After a…”

  • the ease of Linux with a focus on Ubuntu5 Apr 07

    “3till7.net had some excitement yesterday because a post from 2005 got Dugg, and is also garnering a lot of hits from StumbleUpon. I find this funny because it’s such an old post but also because the…”

  • ad blocking through /etc/hosts4 Mar 06

    “There are several ad sites that you’ll see being used everywhere. They slow down page loading, even on fast connections, because sometimes there’ll be lag and they won’t load immediately and instead…”

  • non-English characters in Linux28 Dec 05

    “It’s easy to make accented characters (e.g. é and ü) in Linux. Easier than in Windows, actually, because in Windows you have to remember all those crazy Alt codes, and in Linux, it’s logical combinations of accents and letters.”

  • extracting audio from a DVD24 Dec 05

    “It’s pretty easy to extract just the audio from a DVD in Linux, using Mplayer, sox, and either Audacity or split.”

  • beginning Linux guide21 Dec 05

    “Don’t look on this guide as though you have to learn all this stuff right now in order to be able to use Linux. No. You can get around otherwise, enjoying Linux and getting work done at the same time without messing around with the command-line, which is what a lot of this guide deals with. Look over this guide and then pick and choose what you need. Want to learn how to change file permissions? Check out the section on the chmod command. Want to know what program to use for a certain task? Check out that section. You don’t have to memorize all this stuff to get around, but it’s there if you need it.”

  • Beginning Linux commands5 Jul 04

    “A table of commands that were useful to me when I first began using Linux. Note that all of these may not apply to your particular distribution, configuration, etc.”

Configuration Files

  • DefaultKeyBinding.dict6 Nov 07

    “To make it more convenient for me to take clean notes, as opposed to notes filled with “x^2″ and “y_j”, I looked into changing the key bindings in OS X.”

  • .bash_profile5 Nov 07

    “eval `/opt/local/bin/lesspipe.sh`

    function dir_access_color {
    local DIR=”${1-$PWD}” COLOR=0
    [[ -r "$DIR" ]] && COLOR=1 # red
    [[ -w "$DIR" ]] && COLOR=2 # green
    tput -S <<<$'bold\nsetaf '"$COLOR"
    }”

  • .vimrc11 Nov 04

    “” Indentation
    set autoindent ” Use the current line’s indent level to set the indent level of new lines
    set smartindent ” Attempt to guess the indent level of any new line based on the previous line
    set smarttab
    set wrap ” Wrap long lines visually, but don’t actually insert breaks
    set expandtab
    set shiftwidth=2”

  • .fvwm2rc1 Jan 04

    “# active borders on the desktops
    EdgeResistance 250 10
    EdgeScroll 100 100
    ClickTime 750

    # make sure these fonts exist on your system:
    WindowFont -adobe-times-bold-r-*-*-14-*-*-*-*-*-*-*
    IconFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*”

Apple and OS X

  • make your Mac listen up4 Feb 08

    “I’m so tickled I can’t stand it. All right, so Speech Recognition stuff on a Mac is pretty darn cool by itself, but now I’ve got a nice Apple Script that opens up Safari with various tabs of my favorite sites, and it does this when I tell my Macbook “Get on it.””

  • chmodding and Ruby1 Feb 08

    “Recently, I switched from a Powerbook to a Macbook, and to copy my files from one to the other, I used a pen drive. Since my pen drive has a FAT file system, it treats everything as being executable. This, however, is not the case on a UNIX-like file system like OS X. In order to save myself the hassle of manually chmodding thousands of files, I wrote this Ruby script.”

  • DefaultKeyBinding.dict6 Nov 07

    “To make it more convenient for me to take clean notes, as opposed to notes filled with “x^2″ and “y_j”, I looked into changing the key bindings in OS X.”

  • using Perl and Apache on OS X22 Mar 07

    “What was this /private/etc/httpd/users/sarah.conf that it was talking about? I had never created this file. I checked and it certainly existed. It also had an Options line without ExecCGI–bingo! I simply removed the file because it was just redefining what I had already specified in httpd.conf for Users/*/Site directories (shown above). I then restarted Apache and voila, my scripts worked.”