Node.js Streams and why sometimes they don’t pause()

TL; DR:  If you pipe your node.js streams, make sure you pause the last one in the chain. The longer story: We’re building a node.js application that ingests data from multiple data sources for a client of ours. Since they are quite big in size and in user base (we’re going to process data for… Continue reading Node.js Streams and why sometimes they don’t pause()

Testing with Jest in a node and ReactJS monorepo (and getting rid of environment.teardown error)

Big number of the applications we develop have at least one ReactJS UI, that is held in one repo and an API, held in another. If we need to reuse some part of the code, we do so by moving it to another repository and adding it as a git submodule For our latest project… Continue reading Testing with Jest in a node and ReactJS monorepo (and getting rid of environment.teardown error)

JS variable loaded using wp_localize_script is no longer available

TL;DR: Call the wp_localize_script after registering/enqueuing the script you are localizing. Recently (WP 4.1.4 / WP 4.2) my ajax scripts stopped working. I’ve noticed that it was caused by the fact that the variable for the ajax_url was undefined so for some reason it ws no longer loaded to the page. The reason turned out… Continue reading JS variable loaded using wp_localize_script is no longer available

Retrieving data from a form created with Contact Form 7

If you want to get the data from a form created with Contact Form 7 you can use the ‘wpcf7_before_send_mail’ hook. In your functions.php or from your plugin add action like follows: add_action( ‘wpcf7_before_send_mail’, ‘my_plugin_wpcf7_before_send_mail’ ); function my_plugin_wpcf7_before_send_mail ( $contact_form ) { // TODO: get the data } Since version 3.9 Contact Form 7 removed $contact_form->posted data so… Continue reading Retrieving data from a form created with Contact Form 7

The native Facebook app on Android is no longer forcing you to use Messenger

Today I found out that the native Facebook app is no longer forcing me to use Messenger! At least on my Nexus 4. Seems like in the end they understood that forcing a user to do something is never the right way. From now on feel free to uninstall the crappy Messenger and use the… Continue reading The native Facebook app on Android is no longer forcing you to use Messenger

[Tips and Tricks for Writing WordPress Themes and Plugins] Forcing the browser to refresh your scripts and styles

I’m starting a some kind of thread of posts where I write down some of the nice tricks I meet in WordPress development. First one is how to write your custom theme and plugin files so after each deployment / update you’ll be sure that the browser doesn’t use the cached version of your JS and CSS.… Continue reading [Tips and Tricks for Writing WordPress Themes and Plugins] Forcing the browser to refresh your scripts and styles

Leaflet tiles: Failed to load resource: the server responded with a status of 403 (Forbidden)

If you recently encounter a 403 error for your Leaflet tiles and your map is just showing gray it’s most likely that you’re using the tiles from Cloudmade which decided to discontinue their MapTile service for non-enterprise users. The easiest way to fix it is to change the cloudmade tile url: var tileUri = ‘http://tile.cloudmade.com/APIKEY/88233/256/{z}/{x}/{y}.png’; With… Continue reading Leaflet tiles: Failed to load resource: the server responded with a status of 403 (Forbidden)

jQuery error .apply( matched.elem, args ); undefined is not a function

If you’re having an error in your site/app that says that is undefined is not a function and the error happens on the row containing .apply( matched.elem, args ); (jquery.js:4676 for version 2.0.3). You can do the following 2 things to figure out the error: 0. You need Chrome Dev Tools 1. Enable async for your dev… Continue reading jQuery error .apply( matched.elem, args ); undefined is not a function