WordPress is a very popular platform, as you may know already, counting hundreds of thousands of themes and plugins cause of its developer-friendly approach. So, plugins, may have a GUI. User interfaces in web development, as we know it, need css and js for their graphics and functionalities etc. WordPress core dev team brought us, […]
Category: Programming
Real WordPress Cron Jobs
WP cron is one of the greatest features of WordPress. However, it’s irritating when your site is low traffic, or for whatever reason, wp cron refuses to work properly. You can’t schedule your postings or newsletter digests, social media re-posts, WAF scanning, etc. And if your plan is to get serious about your personal blog […]
Change mysql collation from latin to utf8 – all tables and all columns
Change mysql collation from latin* to utf8 can be done by simply stop being a lazy bastard and, take the time to change the default mysql collation for the new databases you create… But what can I say, I’m a lazy bastard after all. I keep doing the same mistake over and over again. Just […]
Batch Watermark photos with imageMagick script
ImageMagick is an awesome image manipulation tool. It provides an command-line API for literally hundreds of functionalities related to image editing. Every now and then I need to apply watermarks to my images before posting them somewhere online, in public. GIMP, has one or two scripts which extend its functionalities but there’s no neat way […]
Handlebars ifequal helper
Handlebars.js {{#if}} helper lacks of equality condition. In cases where some logic should be put inside the template, some folks prefer to override it. But instead of overriding {{#if}} helper, and taking my chances to break previous/older handlebars templates in my projects, I’m always about to use my custom helper {{#ifequal}}.
1 2 3 4 5 6 7 8 |
Handlebars.registerHelper('ifequal',function(conditional,options) { if (options.hash.value === conditional) { return options.fn(this); } else { return options.inverse(this); } }); |
Usage
1 2 3 4 5 6 7 |
type = "password"; {{#ifequal type value="password"}} <input type="password"> {{else}} <input type="text"> {{/ifequal}} |
Vagrant repackaging box from existing one #vagrant
Vagrant repackaging is a hacky way to create a new vagrant box from an existing one, which is already configured and well tested. In this article, scope is not to explain the benefits of using virtualization in your development workflows. As well, I’m assuming that you: already have the latest vagrant installed, hostupdater plugin and […]
prefix console.log without affecting the line number #Javascript
Prefixing the console.log while keeping its ability to inform you about the code line wherefrom it was called is little hacky but useful to use in your own javascript applications. I was scratching my head while I was coding in one of my projects, I was up to a point that I needed a more […]
Javascript dynamic method initiation for fallback-ing
You can follow this way of dynamic method initiation when you needed to run dynamically all the object methods or providesome fallbacks to any given function. The code is more or less self explanatory. In case you have any questions or an enchancement drop me a comment. A short brief This code continuously iterates over the object methods […]
How to install emmet on Sublime Text 2 via Package Control
Emmet and sublime text 2 (or 3, 3 is Alpha version yet) might be one of the best combos to boost your work flow when writing an application. Sublime text is my favourite editor since I broke up with geany. :P Sublime text 2 We all know sublime text 2 editor, right? It’s a cross […]
Specktator’s #RegEx Cheat Sheet
This is my regular expression cheat sheet. Anchors ^ Start of string or line \A Start of string $ End of string or line \Z End of string \b Word boundary \B Not word boundary \< Start of word \> End of word Character Classes \c Control character \s Whitespace \S Not Whitespace \d […]