These are the Javascript quizes I’ve Tweeted and put up on jsFiddle:
Archive for the ‘Tutorials’ Category
EBNFer
Sunday, August 28th, 2011EBNFer is a railroad diagram generator for WordPress. It lets you use WordPress shortcodes to parse and render Extended Backus–Naur Form diagrams.
Download EBNFer from WordPress.org
PluGeSHin
Sunday, August 14th, 2011A WordPress Plugin for GeSHi
Description
PluGeSHin is a WordPress plugin by Peter Ajtai that lets you use the syntax highlighting of GeSHi through WordPress shortcodes.
You can download PluGeSHin and read about it over at WordPress.org.
This page has samples of PluGeSHin in action.
Visibility Toggling with jQuery
Monday, August 16th, 2010User interface design often makes use of showing and hiding blocks of content. It focuses one’s attention to the right thing, and it’s fun to do with jQuery.
I’ll show you how to toggle the visibility on a group of selected elements. I’ll build up from a simple case to the more complicated ultimate goal.
A few code snippets.
Saturday, July 24th, 2010I often write very short, very simply little code snippets just to test specific things in HTML, CSS, PHP, or Javascript (and jQuery). These are short little blurbs, that are useful for looking at how certain specific things work. They are mostly notes to self.
Here are links to a few of them:
| Short Code Snippets: | |
| CSS | Change image on hover. |
| CSS | Creating large clickable areas. |
| CSS | Images sprites example – External CSS is here – Sprite is here |
| DOM | Checking how many elements in an ID. |
| Javascript | Basketball animation |
| jQuery | Return ID of clicked LI |
| jQuery | Sliding, fading, and disappearing |
| jQuery | Not this array element |
| jQuery | Using toggle() |
| jQuery | A simple infinite image slider |
| PHP Algorithm | A linear linked list |
| PHP Recursion | Turning digits into words |
| PHP JSON CSS | Retrieving and displaying information from Delicious |
| Simple Apps: | |
| jQuery PHP | Guessing game using Stackapps and Stackoverflow data |
| jQuery PHP | Dynamic Syntax Highlighting |
JQuery for a little night time reading
Monday, June 14th, 2010If you use Javascript, JQuery is a great framework to speed up your coding. It’s essentially a collection of really convenient shortcuts. It does more, since JQuery also handles a lot of browser compatibility issues. So, you don’t have to go through your JQuery code to update it for new browsers, all you have to do is download the new version of JQuery, and your old commands will learn new tricks.
Ah, speaking of downloading JQuery, you just might want to understand how JQuery works if you use it. The first time I tried to do this, I simply clicked on my JQuery src file link:
<script type="text/javascript" src="http://peter-ajtai.com/jquery/jquery-1.4.2.min.js"></script>
… and this is what I saw:

Fun reading, huh? Read the rest of this entry »
Three Steps for Using JQuery in Your WordPress Theme
Sunday, May 30th, 2010This is a quick post on using Javascript and the JQuery framework in particular within your WordPress theme. It’s quick and pretty painless. This is just for regular themes, not admin themes, plugins, or posts.
Step 1:
Creating your first WordPress theme – Part 1
Wednesday, May 26th, 2010Content Management Systems and WordPress is so powerful because it allows site owners to update their sites efficiently and to customize their sites and their CMS experience. WordPress themes control both the look of a site and the options a site owner has in terms of customizing this look.
That sounds pretty good and rather vague. It’s hard to describe what you can do with WordPress themes, since they can do a lot. It’s like trying to describe all the things you can do with a nail. It all depends on how you use it.
In light of this, it seems like the best thing to do would be to go through an example of building a WordPress theme. I’ll go through a theme as I develop it, and I’ll try to build it starting at the simplest level and working to progressively more complicated iterations.
Before we begin, there’s a few things that I’m going to assume:
- You’ve got WordPress installed on your site. It’s usually pretty easy to install WordPress.
- You can access the files in your WordPress install.
- You can access your WordPress admin panel.
Piping grep into the Odyssey
Sunday, May 9th, 2010Grep and piping ( | ) are two powerful tools in Linux. Grep allows you to search lines of text for certain patterns using regular expressions. Piping allows you to take the output of one command and make it the input of another.
So, lets say you want to look through the Odyssey and find all mentions of Sirens. That would be:
grep -in siren odyssey.txt
But let’s say you don’t have the Odyssey on your hard drive, you could just get it from MIT and pipe it over to grep
curl http://classics.mit.edu/Homer/odyssey.mb.txt | grep -in siren
In both cases, I used case insensitive search, grep -i, and I list what line number the instances are found on with -n.
So far this has all been pretty straight forward, but I know that the Odyssey is divided into books, and I want to know which books contain the lines about sirens. This is where piping becomes very handy.
curl http://classics.mit.edu/Homer/odyssey.mb.txt | grep -in "siren\|^book" | grep -iB1 "siren"