1 Code Snippet a Month Challenge

Comments 2 Standard

This was initially designed as a way for me to challenge myself in creating a code snippet every month that would be useful to online game development. I did pretty well at first but fell behind in the end as life caught up to me. Hopefully you’ll find some of these useful!

Language(s) Name Description
PHP Format Dates Take country into consideration when formatting dates.
PHP Filename From Domain Path If you have http://domain.com/contacts.php this function returns contacts.php
C++ C++ Mysql Database Class Connect to a MySQL database from a C++ application using this nifty class. You’ll need both the .cpp and .h files
PHP Mixing HEX Colors Take two color HEX values and combine them to get their intermediate color. For instance white (#FFFFFF) + black (#000000) = gray (#80000)
MSSQL Remove All But 1 Duplicate Records For those times when you forget to set a key, or set the wrong key — duplicate records are a pain. Here’s an easy way to remove them all in MSSQL.
PHP/Cpanel Dynamically Create an Email name@yourdomain.com Dynamically create an email account for members as they sign up. This assumes you have cPanel already installed and that you have shell exec rights.
PHP Word Functions For all you word puzzle aficionados.
PHP Dynamically Colored Images, Overlays & Transparencies For all those neopet wanna be games out there. Let your members dynamically color their pets any way they like. This requires that you have php compiled with the GD library.
PHP & MySQL PHP Class File Generator Quick and easy php class file generator. Enter your DB connection settings (or save them in an include file), then select the table you want to create the class for. The generator will generate a .php file for download that has the shell of your OOP class.
Advertisements

2 thoughts on “1 Code Snippet a Month Challenge

  1. Pingback: Programming Challenge Day 2: Get Filename From Domain Path « Online Game Development

  2. Pingback: Programming Challenge Day 3: C++ MySQL Database Class « Online Game Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s