WordPress Snippets

As a WordPress developer I have collected / created / curated many snippets that I’ve used in my projects. I hope you find them useful.  General HTML / WordPress tags Get your template’s directory <link href="<?php echo get_template_directory_uri(); ?>/style.css" rel="stylesheet" media="screen"> Check if this is the home page <?php if (is_home()) { ... } ?>  Remove the wp_generator tag in the Head section of your HTML I recommend you to add this line for security reasons.

iptables snippets

iptables is the default firewall you see on any linux computer. It works by allowing (ACCEPTing) or denying (DROPing) connections to the local computer. There are basically three scenarios you can deal with: INPUT: Connections generated from a different computer targeting yours; for example, when you run a web server on your computer and others want to connect to it. OUTPUT: Connections generated from your computer targeting other computers; for example, when you open a web page or open a remote ssh session.

Installing MongoDB on CentOS 6

The first step is to configure the repositories. Create the following file /etc/yum.repos.d/10gen.repo with the following contents: For 32-bit systems: [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0 enabled=1 For 64-bit systems: [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 enabled=1 Install Mongo yum install mongo-10gen mongo-10gen-server  Configure MongoDB You can configure Mongo by editing the following file: /etc/mongod.conf Set Mongo to autostart on system boot: chkconfig mongod on Start Mongo service mongod start Stop Mongo

A simple C++/Wt (Witty) skeleton for starting an application

The objective of this lesson is to show you how to make a simple web page navigation using Wt. Before starting you have to remember that Wt can be used to create 1 URL applications. That means you can have a full application that runs using just one URL. However it is also useful to give your users different URL’s to take advantage of some browser features like bookmarks or the back and forward buttons.

How to use a WComboBox with C++/Wt (Witty)

In this entry I’m going to create a simple form that shows how to add items to WComboBox in two different ways. The first one is useful for static combo items while the second one might be used to populate a combo from a database. The code is based on our previous Hello World application. There are few lines that changed.  Using Static Combo Items Adding items to a WComboBox is just a matter of calling the addItem method.

Creating a simple form using C++/Wt (Witty)

In this entry I’m going to create a simple form. This form will show you how to use controls and events in a very simple way. A couple things you have to notice before we start: I’m going to inherit from WContainerWidget. As you now know, I could have inherited from WApplication too. Most controls like, WLabel, WLineEdit and WPushButton include a “parent” parameter in their constructors. But you can also create them and add them later to any WContainerWidget.