July 2009
8 posts
1 tag
How to Spam Twitter in 3 Easy Steps (or, The Death...
Despite the fleeting “spammers perish” event a few days ago, my Twitter profile is still overrun by spammy followers. This is really bugging me. I’ve been forced to switch notifications off, and my stop_jackin_it.php script isn’t working because the /blocks/create API method is broken. This will be the downfall of Twitter if it isn’t contained.
So you want to be a...
2 tags
Doctrine and MySQL integers
I just pasted this somewhere handy for my own reference. It’s the logic Doctrine uses to translate the integer data types you specify in schema.yml into a MySQL data type. If you’ve ever wondered why the length you set on an integer isn’t directly translated to the table definition used in your database, here’s why.
For example, the id columns in sfDoctrineGuardPlugin are...
1 tag
stop_jackin_it.php
I’ve been getting inundated by followers who appear to be normal people with a healthy number of followers, but have links to xurl.jp spiced throughout their timeline which resolve to… wait for it… porn.
I’m sick of it. So I did something about it. I cronned this script on my computer and you should to. It will run a search for the string xurl.jp and block anyone posting...
2 tags
Symfony: Denote Required Form Fields
You can checkout the full gist for this tutorial
here.
The symfony form framework separates a form’s presentation and validation into
two distinct collections of classes: widgets and validators. For the most
part, these two codebases live happily without any knowledge of eachother.
When data from the validators needs to be shown in the presentation layer,
such as in the case of error...
1 tag
MooTools: Bubbling Controllers
This one’s an oldie but goodie I just pulled out of my tome of a ~/Sites
directory. Similar to Aaron Newton’s concept of Events
Arbiters,
this class fires events for one object on another object, but I’ve applied the
bubbling pattern you may be familiar with from native DOM events. Instead of
bubbling up a hierarchy of elements, we just bubble up a hierarchy of
controllers.
...
2 tags
MooTools: Ignoring the next click
I’m a big fan of MooTools, as I recently tweeted. I typically try to extend this framework as little as possible, since that can be rabbit hole for me, but this method is just too handy to pass by.
The use case I’m working with is distinguishing between a drag/drop interaction and a click interaction on the same element. If you’re dragging an element, the click event will be...
4 tags
Managing Master and Slave Database Connections...
This is one of those things that should be much easier than it is. Since I
started using Doctrine a few months ago, I’ve been impressed with how complete
it is, but I can definitely see room for improvement as the project matures.
Setting up read and write connections is one of those areas.
My challenge was to get the project I’m on ready to be hosted on Amazon EC2,
with the help of...
2 tags
Doctrine Timestamps and User Timezones
I recently added a “timezone” dropdown to the user preferences screen on a symfony application currently in development. This simple extension to the sfDoctrineRecord class makes it easy to present times from the database in the current user’s timezone.
abstract class myRecord extends sfDoctrineRecord
{
protected function _get($fieldName, $load = true)
{
if ($value =...