Setting up an environment

So, in order to have a vanilla environment where I’ll get to play around and have to configure most of the stuff myself (in order to force myself to learn), I decided to install CentOS 7 in a virtual machine. This will give the added benefit of keeping snapshots so that in case I get locked out of the linux box, I’ll be able to just revert to a previous snapshot. Of course, I could use a filesystem that supports snapshots itself, however I don’t want to. 😛 That’s something that I would like to learn on the distant future, so, point and click snapshots for the time being.

Continue Reading

New Year’s Resolution v0.16

Screenshot of a terminal with tmux running Midnight Commander, vim and htop

Shame on me.

It’s been almost four years without writing a single word in this blog. You can’t – of course – force creativity, but it’s not like I’d write long essays anyway. I do however like the technical side of things and I enjoy challenges in unhealthy amounts, if the enjoyment could be measured, that is.

So, my New Year’s resolution for 2016 is to blog. Not blog as in “sharing my thoughts”, but as in “document my path to the command-line mastering”. Because, yeah, I’ve been putting off learning a shitload of stuff that I want to learn. Did I fail to mention that above?

Continue Reading

Το λίφτινγκ του CSSIgniter

Δέν μπορώ να μήν κοκερευτώ.

Δουλέψαμε πολύ, αγχωθήκαμε ακόμη περισσότερο, αλλά τελικά, την Παρασκευή το βράδυ, βγάλαμε στον αέρα το CSSIgniter με νέο πρόσωπο, 2 ολοκαίνουργια themes, και ένα plugin. Και αυτή τη φορά δέν είμαι μόνος με τον Γεράσιμο. Τώρα είναι και ο Βασίλης με τον Θάνο που πιστεύουν και ιδρώνουν γι’αυτό που ξεκινήσαμε.

Continue Reading

How to check if a shortcode is registered in WordPress

Quick and easy function to check if a plugin/theme/whatever has add/registered a shortcode in WordPress:

function is_shortcode_defined($shortcode)
{
	global $shortcode_tags;
	if(isset($shortcode_tags[$shortcode]))
		return TRUE;
	else
		return FALSE;
}

Just add this into your plugin or theme’s functions.php and wherever you need to check if the shortcode exists, just call is_shortcode_defined(“button”);  or something similar from an if statement, as such:

if( ! is_shortcode_defined("button") )
{
	add_shortcode("button", "my_button_function");
}

Hope this helps.

Continue Reading

Δωρεάν Μετατροπή Συναλλάγματος Ανοιχτού Κώδικα για PHP

Εμπνευσμένος από το Open Source Exchange Rates και την βιβλιοθήκη money.js, δημιούργησα μία κλάση PHP που χρησιμοποιεί την υπηρεσία openexchangerates.org. Απ’ την στιγμή που έμαθα ότι η υπηρεσία αυτή “τραβάει” τις πληροφορίες της από το (ανεπίσημο) Google Calculator API, άρχισα να πειραματίζομαι και με αυτό, και βρήκα κάποιες διαφορές στις τιμές του συναλλάγματος που δίνουν οι δύο αυτές υπηρεσίες. Πιθανώς οφείλεται στο ότι το openexchangerates.org ανανεώνει τις τιμές του κάθε ώρα, αλλά όπως και να έχει, οι τιμές είναι διαφορετικές, και για κάποιες εφαρμογές ή sites η διαφορά αυτή μπορεί να είναι σημαντική.

Οπότε συγχώνευσα και τις δύο υπηρεσίες στην κλάση. Το μόνο που χρειάζεται είναι να περάσετε την σωστή παράμετρο στον constructor της κλάσης, και είστε έτοιμοι να ξεκινήσετε τις μετατροπές του συναλλάγματος.

Continue Reading

Free Open Source Exchange Rates for PHP

Inspired by the Open Source Exchange Rates and money.js, I’ve developed a PHP class that consumes the openexchangerates.org service. Since the service fetches the exchange rates from the (unofficial) Google Calculator API, I played around with it as well, and found some differences on the exchange rates provided by the two services. It is probably that some caching is involved with openexchangerates.org (it updates every hour), but still, the rates are different, and for some applications more up-to-date rates may be necessary.

So I made both available for use with the class. You only need to instantiate the class passing the appropriate parameter on the constructor, and you are ready to start converting.

Continue Reading

Integrating CodeIgniter and MagpieRSS

So you want to use MagpieRSS from within CodeIgniter, so that you can fetch some feeds and do naughty stuff with them. No problemo. You download Magpie and you find that there are a few required files that depend on each other, and have an extension of .inc instead of the more common .php. Renaming the files will be a hassle, since you must find/replace all instances within the source code, and that will be a nuisance in case you later need to update your version of Magpie.

Continue Reading