Once a user has submitted a form, you generally don’t want them to submit it a second time.1 A nice way to handle this is to disable the submit button once the form has been submitted, while replacing the text in the submit button with a message to let the user know that their desired…
Code Archives
-
-
For some reason, the example code in the Laravel docs for their Mail feature neglect to show how to pass defined variables into the closure. Here is something a little more useful. View the code on Gist.
-
I’m a big fan of keyboard control in productivity applications. I love being able to type my changes/additions and submit them without needing to tab around too much, or gasp grab the mouse. I’m not the only one who feels this way. David Walsh has a great post explaining how to submit web forms with…
-
I was recently trying to make some API requests from within WordPress using `wp_remote_get()`, but the site I was asking for data from was rejecting requests from the default WordPress User Agent. I tried to set the user agent to something different, but it still wasn’t working: $response = wp_remote_get($url, array( ‘timeout’ => 20, ‘User-Agent’…
-
I’ve been getting friendly with SASS as Crowd Favorite has standardized on that for our CSS pre-processing. Today I was excited to learn1 I can use variables for selectors (and for property names, etc.) as well as for property values (the common usage). View the code on Gist. I’m going to really like this for…
-
As alluded to earlier, I’ve cleaned up my projects page which is now powered by a new taxonomy, custom post type and the content I’ve generated here over the last decade plus. Turns out, I’ve generated quite a few projects. 🙂 I’m not completely done creating and managing the content, but I’m pretty happy with…
-
I recently posted about how to include a plugin in a WordPress theme properly. Here I will touch on the converse – how to make sure your plugin will work nicely if it is loaded by a theme. My general approach to development is to create discreet features that can interact with each other in…
-
In our FavePersonal theme we integrated the excellent Social plugin from MailChimp and included an option to turn it on or off. Most importantly we did it in a way that still allows the Social plugin to be installed and updated independently. We made sure that we implemented this in a manner that: respected users’…
-
I really like the fullscreen editor in WordPress. I use it nearly all of the time when composing long-form content, often in conjunction with the excellent Markdown on Save plugin by Mark Jaquith. It has always bugged me that there wasn’t a Preview button in the fullscreen mode toolbar. Problem solved. Here’s the code. View…
-
If you need to remove non-public user data from a WordPress database, these SQL queries should do the trick for you: View the code on Gist. Note that if you have plugins, etc. that store additional user data in user meta you might need to clear those out as well.
-
A super simple bash function for opening the source of a URL in BBEdit. View the code on Gist. Enhancements/improvements gladly accepted.