Posts

Link Post: favicon.js

I not actually using this in a project (but I'm going to soon) but this library allows you to dynamically add a badge to your site's favicon.

http://lab.ejci.net/favico.js/

Organizing Your PuPHPet Files

I love how convenient PuPHPet makes creating and maintaining your website's VMs but I hate how it adds two additional folders and three additional files to the root of our project.

It turns out there is a quick solution to this problem.

Create a new folder named Vagrantfiles and copy every file except the Vagrantfile into this folder. Then find this section of your Vagrantfile:

config.vm.provision :puppet do |puppet|
  puppet.manifests_path = "manifests"
  puppet.module_path = "modules"
  puppet.options = ['--verbose']
end

and change it to:

config.vm.provision :puppet do |puppet|
  puppet.manifests_path = "Vagrantfiles/manifests"
  puppet.module_path = "Vagrantfiles/modules"
  puppet.options = ['--verbose']
end

Now it's much cleaner so I can dump all the files I need for my project there. :-)

Masters of Doom: How Two Guys Created an Empire and Transformed Pop Culture

I just finished reading Masters of Doom: How Two Guys Created an Empire and Transformed Pop Culture and I couldn't put it down. It focus on the lives of John Carmack and John Romero and how they created id software and what it did to the world. Parts of it read like a biography and parts of it read like a crazy drama where nobody can get along. I won't ruin it for you but I'm surprised that id is still a company after reading this book.

Checking For Non-Existent Dates in Javascript

I needed a quick way to verify that the date the user was entering into an input box was a valid date in a calendar (not 14/50/2013). I created the following function to do so. It only works with mm/dd/yyyy and yyyy-mm-dd but it's easy enough to extend for others.

function isValidDate(date){
    var year = 0;
    var month = 0;
    var day = 0;

    var match = date.match(/(\d{2})\/(\d{2})\/(\d{4})/);
    if(match != null){
        month = match[1];
        day = match[2];
        year = match[3];
    }

    var match = date.match(/(\d{4})-(\d{2})-(\d{2})/);
    if(match != null){
        year = match[1];
        month = match[2];
        day = match[3];
    }

    month -= 1;
    var testDate= new Date(year,month,day,0,0,0,0);

    if (testDate.getFullYear() != year){
        return false;
    }

    if(testDate.getMonth() != month){
        return false;
    } 

    if(testDate.getDate() != day){
        return false;
    }

    return true;
}

Link Post: 10 Easy Steps to a Complete Understanding of SQL

This is a very dense article but it has a lot of little nuggets of information for someone like me who self taught themselves SQL as the needed it.

I think this is the part that was super helpful to me:

SELECT is executed after most other clauses. Most importantly, after FROM and GROUP BY. This is important to understand when you think you can reference stuff that you declare in the SELECT clause from the WHERE clause.

This causes me to have problems like this (their code sample):

SELECT A.x + A.y AS z
FROM A
WHERE z = 10 -- z is not available here!

http://tech.pro/tutorial/1555/10-easy-steps-to-a-complete-understanding-of-sql via Reddit?

Quickly Switch Between Two Git Branches

When I work on client work I usually have to branches the master branch that always contains the current state of the site on their server and a devel branch that contains new code. This way I can quickly switch between working code and devel code.

Normally, I do this using the following commands:

git checkout master
git checkout devel
git checkout master

But that's a lot extra typing because it turns out there there is a quicker way to do this.

git checkout -

Video: Spooning by Bitbucket (Pair Programming Joke)

I'm so happy this isn't actually how pair programming works.

[embed]http://www.youtube.com/watch?v=dYBjVTMUQY0[/embed]

via Reddit

Link Post: Adult Cat Finder

I'm not sure if this is the most awesome thing or the dumbest thing I've ever seen but I wish there was some way I could hide it in a project.

Are you having a hard time finding local cats in your area? Do you wish there was a way to connect instantly with one online, at any time? Now you can!
With Adult Cat Finder, you're never more than one click away from chatting with a hot, local cat in your area!

http://adultcatfinder.com/

Link Post: How git works

A quick read on how git stores it's data. The part I found interesting was that git stores whole copies of the files you create when they're committed and then calculates the diffs on the fly. It also talks about the git repack command which I didn't know existed and I will have to experiment with soon on a non-critical repo.

http://slidetocode.com/2013/08/25/how-git-works/

Link Post: The Top F2P Monetization Tricks

This is an interesting article that goes over the various techniques used by Free to Play (F2P) games. I think F2P and freemium are the future of gaming and in a lot of cases web sites.

http://www.gamasutra.com/blogs/RaminShokrizade/20130626/194933/The_Top_F2P_Monetization_Tricks.php

RSS

Join Our Mailing List!

View previous campaigns.

Top Posts

  1. Working With Soft Deletes in Laravel (By Example)
  2. Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
  3. Upgrading to Laravel 8.x
  4. Get The Count of the Number of Users in an AD Group
  5. Multiple Vagrant VMs in One Vagrantfile
  6. Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
  7. Changing the Directory Vagrant Stores the VMs In
  8. Accepting Android SDK Licenses From The OSX Command Line
  9. Fixing the 'Target class [config] does not exist' Error
  10. Using Rectangle to Manage MacOS Windows

subscribe via RSS

All content copyright This Programming Thing 2012 - 2021
Blogging about PHP, MySQL, Zend Framework, MySQL, Server Administration and Programming in general