Display MailChimp Subscriber Numbers on WordPress

If you have a ton of MailChimp subscribers, and want to tell the world (and build more subscribers in the process), the MailChimp Subscriber Chiclet Plugin is for you.

color-options
Features:

  • Four colors
  • Easy-to-use WordPress Shortcode interface
  • Configurable link to MailChimp signup page
  • Configurable text

A pro version is coming with a few more features than the free version.

Download the free version from WordPress.org now: MailChimp Subscriber Chiclet for WordPress

ArcGIS JavaScript Draggable InfoWindow

The InfoWindow on a web map is the primary method of of showing information on selected items in the map. The map control automatically does its best to show the InfoWindow within the the viewport of the map, but on some maps and in certain situations, it may be appropriate to allow the user to drag the InfoWindow away from the automatically placed location. This is can be done easily with the dojo/dnd/Moveable module.

dojo/dnd/Moveable simply takes a DOM Node reference. To make the InfoWindow of the map draggable, pass map.infoWindow.domNode to the Moveable constructor. For a great user experience, pass the title bar as the “handle” and remove the indicator triangle pointer once user has dragged the InfoWindow:

In what situations have you used a draggable InfoWindow Popup? Let me know in the comments.

Dojo dgrid Filter

TomandJerryTitleCardcdgrid and dstore, the Tom and Jerry of the Dojo world are wonderful for creating dynamic, data-driven tables. If you haven’t heard of them, check ‘em out.

Creating a simple textbox that live-filters your dgrid is not super-obvious though. Here’s how.

First you must understand how dstore and dgrid work together. Here’s a summary:

dstore provides a common API for accessing and manipulating data. It is intended to replace dojo/store and the older dojo/data API. Starting with 0.4 dgrid interfaces directly with dstore stores. Previous releases of dgrid worked with dojo/store instances, and the older dojox/grid works with the older dojo/data API.

~ dgrid: Using Grids and Stores

In other words, to filter the dgrid, just filter the dstore that drives it.

First, create your dstore and dgrid. Then wire up your TextBox to call a function on every keypress:

Then write your function. Here you want to go through all the grid columns, creating a Filter on each one, and apply them to the dstore. Finally, set the dstore’s filter to the new Filter you created:

Here it is in action (code).

FlyingSorceress3

Sublime Text Multiple Command Shortcut

pluginOn my team at work, many of us use the Sublime Text editor. I use two packages to keep my code clean – JsFormat and AmdButler. These are great, but it’s a pain to run them separately. Why not run them both with a single keyboard shortcut?! Here’s how to do that.

After you have both packages installed, go to “Tools > New Plugin”. Use this for your new plugin:

import sublime, sublime_plugin

class SortAndJsFormatCommand(sublime_plugin.TextCommand):
	def run(self, edit):
		self.view.run_command("amd_butler_sort")
		self.view.run_command("js_format")

Sublime Text automatically exposes a “command” by taking the camel-cased name of your python class, replaced with underscores, and removing the word “Command”. So the command name is “sort_and_js_format”. You can now use this if you go to “Preferences > Key Bindings – User” –

{"keys": ["ctrl+alt+s"], "command": "sort_and_js_format"}

(Thanks to this StackExchange answer for help)