elasticsearch Elasticsearch 2.3 cluster with Docker This is a guide for starting a multi-node Elasticsearch 2.3 cluster from Docker containers residing on different hosts. This is not a guide for creating a production worthy ES cluster, but is more for edification (perhaps another guide will be released with some
react Trigger a sub-component event with Enzyme I was struggling to get sub-component interactions nailed down and figured out a few ways to propagate your sub-component interactions with Enzyme. In my scenario, I had a component that relied on some simply sub-components. The sub-components essentially extend default HTML controls with a
react Flux to Redux: Convert Container Components In the previous articles we discussed converting Actions and Stores into Reducers. In this article, we'll discuss converting a Flux Container component into a Redux Container component. Container components act as the glue between your stores/reducers and the underlying "dumb" components.
react Flux to Redux: Converting Stores to Reducers In the previous post we converted Flux actions to Redux action creators. The next part will discuss converting stores into reducers. Stores are more complicated, but they should contain similar logic in both Flux stores and Rexux reducers. In genearl, stores with significant logic
react Flux to Redux: Converting Action Creators This is the first part in a series of tutorials showing how to convert Flux code to Redux. I find it easiest to start by converting actions from a standard Flux action into a Redux action. This allows you to start at one thread
aws A simple AWS CloudFormation example with Lambda and Kinesis I finally took the plunge and played around with creating a CloudFormation template. It was actually easier than I thought it would be. So that's a plus. Most CloudFormation scripts are very daunting to view... so I'll explain some of the fun stuff I
c# C# Quoted Printable Enjoy! static string DecodeQuotedPrintables(string input) { var occurences = new Regex("(\\=[0-9A-F][0-9A-F])+"); var matches = occurences.Matches(input); foreach (Match match in matches) { byte[] bytes = new byte[match.Value.Length / 3]; for (int i = 0; i < match.Value.Length / 3; i ++) { bytes[
design patterns Chained callback pattern in Javascript Imagine we have four methods a(next), b(next), c(next), d() where the first three accept a callback. We want to execut these methods in order, so that a completes and calls b, b completes and calls c, and c completes and calls
mongodb Aggregate on string length in MongoDB It's not actually possible to use the aggregation pipeline to aggregate on string length, at last in MongoDB 3.2 (the current version as of this writing). You may think that you can use the $size operator, but alas you'll end up with errors
nodejs Reload module with Node.js require In Node.js using require to load a module will cache the result. If a module exports a constructed object it will be treated as a singleton, meaning it will only be constructed once While this is useful and performant for your application, it
nodejs Retain tty when using child_proces.spawn In trying to use child_process.spawn to launch a series of script files, I was running into an issue getting the child processes to render their progress. Normally, and as per the documentation for spawn, you can attach to the child process by
javascript Function wrapping with Javascript Decorators One of the best uses for ES7/Javascript 2017 decorators is adding additional functionality to a function. This article will discuss the basics of decorators and show some patterns that can be used to help write cleaner code. Note: ES7/Javascript 2017 decorators are
c# C# cross-process synchronization with mutexes This example shows how you can use a mutex in C# to perform cross-process locking. For me, I needed a way to perform file system synchronization across multiple processes. Mutexes provide locking at the OS level to allow you to block until the Mutex
react Select placeholder with React Here's how I created a 'placeholder' effect for an HTML select element in React. The gist is that you create a react component that checks if a value has been set. If there is no value, a placeholder class is applied to the select
react React - passing a value with onClick I ran into an issue where I had a list of items being rendered and wanted to trigger an action if one of them was clicked. For instance consider this component that renders a list of items. It creates an li for each item.
javascript Testing async/await with Babel and Mocha I was curious about testing ES6/7 code transpiled with Babel. Getting it to work is fairly straightforward. Here's what I found... Setup The documentation for Babel tells you to setup an NPM script to run mocha tests as such: { "scripts": { "
javascript Gettings started with Babel and Node I've been using Babel recently to perform transpiling of Node.js code. I've previously used Traceur and it always left a bit to be desired. The big winner now, is the support of ES7 code such as async/await. This guide will show a
c# vNext ASP.NET 5 Custom Middleware If you're curious about creating custom Middleware in ASP.NET 5 here are a few things I've come up with while playing around. First a little background... Middleware gets attached to the IApplicationBuilder inside of the Configure method of Startup.cs. Middleware allows you
c# vNext C# Dependency Reference using NPM instead of NuGet Natively, Visual Studio 2015 integrates with NuGet for project dependency resolution, see here for a bit more info. This workflow is heavily tied to NuGet, which in my opinion is both good and bad. While it's nice that Microsoft is making strides away from
c# vNext Depedency Injection Overview I've been playing around with the latest version (beta4) of ASP.NET 5 and vNext and I have to say I'm impressed. One of my favorite features is the addition of the Dependency Injection module that will become a staple of the .NET applications.
express Custom mail subscriptions using MailChimp MailChimp is a pretty awesome service. In a project I was working on, I wanted to create multiple lists for different types of email newsletters. The website I was using was powered by Express and Node.js. Here's a little bit of code to
express Multiple views directories with express-hbs This article talks about how you can put views in multiple locations and still use Express 4's default view rendering pipeline. When configuring the express-hbs view engine, you must specify the path for the views. This acts as the jumping off point for all
express Handlebars templates with Express 4 In a previous article I discussed adding server side Handlebars templates to Express 3 using express-hbs package. This article is an update that discusses Express 4. Setup Configuration is quite simple. You first set the view engine in express. Then provide configuration information for
backbone Backbone Notes Models Create a model class: var Appointment = Backbone.Model.extend({}); You can add defaults to a class: var Appointment = Backbone.Model.extend({ defaults: { title: 'Checkup', date: new Date() } }); Or as a function to defer creation for new objects until they are newed var Appointment
javascript Replacing jQuery enrichment with Backbone on a server-side rendered website. My task was adding a newsletter signup form to a website. Simple enough task. The site is rendered on the server-side using Node.js, Express and Handlebars. Performing a full page refresh to post a bit of data on a single-page marketing site seemed