Using Git for WordPress plugin development.

I haven't used Subversion in years, and while I have done a lot of WordPress plugins over the year for work, they were all private and we never shared them on the registry.

I prefer to use git. I knew it had a svn sub-command however I've never used it. I spent the better part of a day trying to figure out how to push to WordPress's Subversion from git.

I tried to follow several guides but I kept getting Unable to determine upstream SVN information from working tree history, I spent hours googling it, eventually I came to the conclusion I have to use a different branch.

I thought I'd share this. might save someone few hours of frustration.
Continue reading


A simpler way to fight spam on WordPress

Update (2014-04-04) : The plugin is on now in WordPress's registry and on github, feel free to submit any patches.

There are 100s of different plugins that fight spam for WordPress, however almost all of them require user interaction someway or the other, and usually they require a remote service to verify the user's input.

While I was trying to combat spam on this site, I came across Anti-Spam, great concept, however it still required the user's interaction, and then my gears kicked in after analyzing the 1000s of spam comments that were posted on the site I wrote a very simple plugin to combat comment spam.

ChangeLog :

Continue reading


The performance of using interface{} vs a specific type.

I've recently started learning Go, and I have to say I'm very amazed by the whole concept of Goroutines, specially coming from a NodeJS / C++ background.

But sometimes it's nice to have a variable with a dynamic type, which Go does support (aka interface{}) , then I started wondering about the performance of using it vs just using one specific type.

I wrote a simple benchmark, at first I was rather disappointed at how slow it was compared to using the direct type, then I tried using goroutines to speed it up, with both buffered and unbuffered channels, surprisingly it didn't help at all, it even slowed it down farther.

Since the benchmark is simply summing some numbers, I decided to try atomic.AddUint64(), and while it was a tiny bit slower for defined types, it was much faster using interface{}

Continue reading




Pasting in VIM from KDE’s clipboard

For some reason I couldn't find it anywhere, but the register for the KDE clipboard ( ctrl-c / ctrl-v) is + not *.

To paste from the KDE clipboard in insert mode : CTRL-R +, in normal mode : "+p.

To map it to ctrl-v : :imap <c-v> <c-r>+, this way you can just press ctrl-v in insert mode to paste the system clipboard.

To paste from the system selection (mouse middle button) in insert mode : CTRL-R * or in normal mode "*p .

To paste from the VIM buffer in insert mode : CTRL-R ".

To set the system clipboard as the default clipboard for vim (for yy,dd,cc,p) : :set clipboard=unnamedplus .

Also make sure to check :registers .


Change CPUFreq governor on all CPUs

While I love KDE, I still prefer to use command line for almost everything.

A simple bash function to set/list all governors (add it to ~/.bash_profile)


Workaround for Wine/World Of Warcraft Crashing on Linux 64bit systems with > 4gb of RAM.

I recently got a new computer with 8gb of RAM, and since then World Of Warcraft crashed very often with out of memory errors.
After banging my head for hours every time I crashed in dalaran or coming out of the arenas, I finally discovered setarch(8).

Start the game :

While it isn’t a perfect solution, it work’s for the most part.