Jon's Programming Blog

Swagger is too Restrictive

Swagger has a definite idea of what makes a good URL. But if you want to do anything outside of that good luck. I think, that even though it seems like a good idea to push people towards a standard it doesn’t allow the user to really create RESTful APIs which suit their own needs. Let’s say that you have a reports resource. Sometimes you would like to get the JSON data of the report.

JavaScript-Style Promises in F#

Working in enterprise level back end software often times I need to get information from many different sources. When you have enough of these sources the time it takes to get all the information can really add up. That’s when F# async work flow really comes in handy. Except, there is a gotcha. Let’s say we have two sources we need to fetch data from: let myData () = async { let!

Using NPM as a Build Tool

I really like simplicity. The tools I use, I like them to make my life easy, not hard. They need to work out of the box. No huge configuration settings, just make it easy so I can get to work. Well, along come grunt, gulp, and now even more tools since I first started writing this that I won’t mention. Two build tools for JavaScript. Wonderful, we need tools to help us build our files.

On-the-Fly Lambda Expressions in JavaScript

Before many of the JavaScript compilers became real popular and if you wanted to write in straight JavaScript you could create functions on the fly. This was really nice for doing lambda functions. Here’s a couple libraries that did this. Here’s how it basically worked: var f = function(func){ var funcArray = func.split('->') return (funcArray.length === 1) ? new Function('x', 'return (' + funcArray[0].trim() + ')') : new Function(funcArray[0].

Building a Convention Based Routes in Node.js

Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, and not necessarily losing flexibility. It seems in programming, if we haven’t learned the basic practices of others, we’ll end of repeating those practices; discovering them on our own. This isn’t necessarily a bad thing. It can be a good way to learn.

CSS Media Object

I just finished attending the RockIt Bootcamp (12 week program). It’s a program that teaches the LAMP full stack development (Linux, Apache, mySQL, PHP). In the next little while I will be going over some of the things which I learned. The css media object was first coined by Nicole Sullivan in 2010. It is still one of the most basic constructs to learn and understand in created good CSS content.

Angular.js vs React.js vs Mithril.js

Apparently Facebook has a bunch of functional-style programmers, not writing in ClosureScript though! [Starts at 40 minute 30 seconds. Person asks question then Jing Chen laughs at question, she must know how much Pete doesn’t like Angular.] So, the question was comparing and contrasting…React plus Flux and Angular. …[T]hey do solve some of the same problems but they go at it in very different ways. So React is focused a lot on treating your code as a black box.

bilby.js & lenses

In JavaScript nearly everything is mutable. This can cause problems in your code when you think you have a new object or variable but instead you are operating on the referenced object. So, we create patterns to alleviate this problem. Or we use libraries like underscore.js or lodash.js which incorporate the functional concepts. Unfortunately they don’t always use immutable objects either. Bilby.js solves the mutability problem by using lenses. Using the lenses pattern one can access and change one’s objects in a safe and immutable manner.

Match Expression for JavaScript?

Sometimes (or rather most of the time) it would be nice to have more concise code in JavaScript. I was working with a function that needed quite a bit of if statements. if was awfully cluttered. I had looked at bilby.js examples and hadn’t realized that you can do multiple ternary expressions in a row. So, instead of, if (0){ return 0 } else if (1){ if (2) { return 1 } else if (3) { return 2 } else { return 3 } } else { return 4 } You can do,

A Distributed & Robust Feedly

In light of the recent attack on I thought it might be interesting to see other ways we could propogate data accross the Interent without being succeptible to attacks, or, at least less accessible. With the approach outlined below we need to use an actual app instead of being able to use a browser (there might be a way to use a browser also, not sure how it would work though).