Category: Software Development
-
reCAPTCHA is broken
In the words of the Security Level setting for CloudFlare’s Firewall: I’m Under Attack! As it turns out, I’m not a stranger to having bots on my social network, Ginpop.com. I’ve even documented my previous experience with a DDoS attack and how to mitigate a WordPress Pingback attack! This particular…
-
How to calculate Mother’s Day in JavaScript
One of my favorite features of PHP is the strtotime function. It takes a string and gives you the equivalent time in return. Unfortunately, there’s not something similar for other languages. There are other ATTEMPTS to duplicate the function, but nothing I’ve ran into that works quite as well. With…
-
Vertical alignment is a waste of time
As I’ve gotten older, code formatting has become less and less important to me. When I was younger, it was the world, but as of late, it’s a nice to have. What’s truly important to me is whether or not anybody is using the things I’ve built. I’m still fairly…
-
Reading a specific line from a file with PHP
As I’ve been building a system that is driven primarily by CSV files (because it’s easier to use Google Sheets than it is to build out an admin section) I’ve had to get creative. Recently I found myself working with a CSV file that’s around of 3000 lines of data…
-
Convert Mongo BSONDocument to an array in PHP
Ran into a scenario this weekend where I needed to take a sub-document from Mongo but I needed it in an array in PHP. Reading the data from Mongo with PHP was simple and won’t be discussed. What I’d like to talk about is taking the BSONDocument that Mongo returns…
-
Programming the same thing in multiple programming languages
Recently I set out on an interesting journey. I wanted to build programming libraries for my API, HolidayAPI. Some of the languages I know like the back of my hand. Others, have never even touched them before. Before you start sending me hate comment, I am fully aware of Swagger….
-
Sourcing external files from your .gitconfig
If you’re like me, there’s a great chance that you have not only some public dotfiles but you also have some private stuff you don’t want the world to have open access to. I refer to these private dotfiles simple as dotprivate. I include my dotprivate files as a submodule…
-
Set Vim tab spacing based on the type of file
Now that my buddy Justin is back to using vim, he’s been flooding me with questions. Loljk, but he did ask about setting the tab spacing based on the type of file he was working with. Incidentally, this was something I had just improved in my dotfiles. Back before I…
-
Get the day of the week from a date in PHP
Typical of PHP, it’s very easy to get the day of the week from a date, but they also provide the data in multiple format. Three in fact. The first, and arguably the most straight forward is to get the textual name of the day of the week. <?php echo…
-
Calculate time left in day in PHP
Before PHP 5.3, finding the difference between two dates was a bit of a pain. Convert the date strings to UNIX timestamps (if they weren’t already), subtract them, and then divide the result until you had each of the components (seconds, minutes, et cetera). As of PHP 5.3+ you can…