Archive for the ‘ Code ’ Category
I have come across some neat (if not mind blowing) tricks with JavaScript recently. Firstly, I needed JavaScript code that copied PHP’s urlencode(). This function returns an encoded string where all non-alphanumeric characters except - _ . are replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) [ READ MORE ]
Recently I needed to post XML to a particular API and this API required HTTPS authentication. So I needed to send a username / password with the request. This was pretty straightforward in C#.NET ( at least from my foggy memory ). You needed to use NetworkCredentials. But it was a bit difficult to find [ READ MORE ]
We use pre tags in the Polldaddy plugin to display the embed codes and short URLs. We use pre tags because it formats the text inside the tags as we insert it, which is ideal for displaying code in particular. The thing is, people like to copy this code and they have to go to [ READ MORE ]
I was looking into flash’s local shared objects ( from here on LSO’s ) recently as a method of data persistence on a clients browser as the plain old HTTP cookie has its limitations. LSO’s are like cookies and are sometimes referred to flash cookies but there are 2 main differences between them. A normal [ READ MORE ]
First off, regular expressions are great. They are a handy quick way to validate or parse data and you can use them in almost all languages. But of all things, I forget neat regex’s and in fairness they are a pita to recall as the syntax is plain nutty. This is where it ends. I [ READ MORE ]
I love gems like this. I come across them from time to time but they never stick… then I do a search to find them again. Anyway a simple way to determine if a number is odd or even, use the following code. function is_odd( $number ) { return $number & 1; } Quick explanation [ READ MORE ]
I am developing ( not from scratch, thanks mdawaffe for the leg up! ) a plugin for polls and ratings on WordPress.org, available here. It basically uses the core code used on WordPress.com with a few extra’s necessary for that platform. The plugin allows you to create and manage polls and ratings from within your [ READ MORE ]
We encode our polls in UTF8 so all sites will be able to render them. But there was an issue with our polls at one stage, when the poll dynamically loaded content into the site, like after a vote, the text in the poll would render all screwed up. For people unfamiliar with how widgets [ READ MORE ]
Subscribe to this blog by email.