Page 3 of Software Development Articles

React Draft Wysiwyg with MongoDB

We love open source software here at CrowdSync. Sometimes though, we run into issues with the software we’ve deemed as the “right” package for us. A recent incident has been with React Draft Wysiwyg which we decided to use as part of our action to compose and send emails to […]

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 […]

Make open source contributions a priority

I get it, you got a metric shit ton of stuff going on at work and open source contributions aren’t necessarily one of them. Bet there’s a good chance you have at least one side project though. Also bet there’s a good chance that you don’t make open source contributions […]

How to calculate Easter Sunday in Javascript

Regardless of your religious beliefs, you are probably aware that Easter Sunday occurs on a sliding scale. This is because Easter is a moveable feast and the date is determined by a lunisolar calendar. Originally I was planning to talk about how to calculate the date of Easter in Javascript. […]

How to capitalize the first character of each word in a string in Javascript

The other day I had posted on capitalizing the first letter of a string in JavaScript. But what if you wanted to capitalize the first letter of every word? With PHP it’s just a simple call to ucwords and just as easy in Ruby and Python. To be able to […]

Migrating from Mandrill to SparkPost

If you’re reading this then you where probably slapped by MailChimp’s latest announcement to merge Mandrill into MailChimp. You may be outraged because you were on their free tier which is going away. Personally I don’t agree with your rage. In fact, I think you’re a freeloader. That being said, […]

Multiple buttons with Hubspot's Vex

I’ve been implementing HubSpot’s Vex library as a replacement for stock alert(), confirm() and prompt() dialogs on SceneKids recently. In one use case, I wanted to be able to have 3 buttons on the dialog with each button returning a value, instead of just boolean true for the OK buttons. […]

How to Capitalize the First Letter in a String in JavaScript

I’m still kind of spoiled by the built-in functions in PHP (as well as Ruby and Python for this particular task). Something like capitalizing the first letter of a string is a trivial task in most languages: <?php // Capitalize first letter with PHP ucfirst('some string that needs the first […]

Using an 11” MacBook Air for development

I do it, and I do it well. In fact, I’ve built an iOS game on it and used one exclusively without an external display while working at Sumo HQ in Austin, TX this past week. The 11” MacBook Air is a decent machine, even if you think the screen […]

Tracking peak users online with Redis

This probably isn’t the best way to track things, but it’s the best I came up with. Tracking the total number of users that log in per day or month is trivial as I have discussed in a previous post. To track the peak users online at a given time […]

Email validation via MX lookup in PHP

Validating that an email addresses ain’t what it used to be. I remember writing simple regular expressions that worked out really well. These days there are a bajillion TLDs with more being added all of the time. Something I started doing is checking that the domain of the email being […]

Check if a string contains a character with PHP

Checking if a string contains a character could be accomplished easily with a regular expression or you can use the built-in PHP functions. To check if a string contains a character of a specific case you can use strpos. $haystack = 'This is my haystack that we shall check' $has_A […]

Generate random hex color with PHP

There’s many ways to skin a cat, or generate a color. You could randomize a number between 0 and 16777215 then convert it to hex: $rand_color = '#' . dechex(mt_rant(0, 16777215)); Or you could do what I like to do, just md5 a random string and grab the first 6 […]

Run a block of PHP code a certain percentage of the time

Sometimes, you may want to run code all of the time. Other times, you may want to run code some of the time. This is how garbage collection in PHP works. Based on your configuration for gc_probability and gc_divisor, garbage collections runs a fraction of the time (defaulting to 1/100 […]

CSS `:not` issue in Safari on iOS9

Seems that every time that Apple releases a new version of iOS I encounter some weird rendering issue. This time around with iOS9 I encountered an issue where the full / desktop version of the site looked like it still using some of the mobile / smaller device stylings. After […]

Stop submitting feature requests for Open Source Software

A few years back I wrote about my experiences contributing to and maintaining open source projects. Since then, I’ve done my share of forking, pull requesting and even starting up new projects that people are forking and pull requesting. I make a very conscious effort to contribute to projects that […]