Skip to content

Instantly share code, notes, and snippets.

@jmacias
jmacias / gist:2956597
Created June 19, 2012 21:19
Head First Data Analysis - Chapter 10 Regression: Prediction. Solution using Clojure and Incanter.
(use '(incanter core stats charts io))
(def salaries (read-dataset "http://www.headfirstlabs.com/books/hfda/hfda_ch10_employees.csv" :header true))
(def salary-plot (scatter-plot
;; Select the col requested where the negotiaded col is TRUE
(-> (sel salaries :filter #(= (nth % 3) "TRUE"))
(sel :cols :requested ))
(-> (sel salaries :filter #(= (nth % 3) "TRUE"))
(sel :cols :received ))))

Or definition of better it has a better economic characteristic. All our decisions on product development must have an economic characteristic.

Is it always better to prevent problems than it is to find and fix them? NO, you compare the cost of preventing to the cost of finding and fixing problems.

#Dangerous ideas in software development

  • Strive to Eliminate Variability
@jmacias
jmacias / gist:3862587
Created October 10, 2012 01:24 — forked from fogus/gist:3690710
Books I recommended today
@jmacias
jmacias / query.clj
Created February 15, 2013 09:42 — forked from mtnygard/query.clj
(ns rxjava-datomic.query
(:require [datomic.api :as d])
(:use [clojure.repl :only [pst]])
(:import [rx Observable]
datomic.Peer))
(defn query [qry & inputs]
(Observable/toObservable
(Peer/q qry (object-array inputs))))

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@jmacias
jmacias / composable.js
Last active December 17, 2015 03:38
Composable functions in Javascript with underscore.js contrib
// Not composable function: DON'T DO THIS!
function complexProcess() {
var a = getComponent(globalState),
b = subprocessOne(a),
c = subProcessTwo(a, b),
d = subProcessThree(a, b, c);
resetGlobalState(d);
}
// Composable Funtion

Application specific host grouping in Riemann-dash

It is generally desirable to group all the hosts for a specific service into a single dashboard view. For example, all the web servers are in single view while all the database servers are in another view.

This is usually not an issue when you are sending custom metrics using Riemann client. However, there are cases where you are using something that you do not control how the metrics are being sent. i.e., Riemann-tools.

Since Riemann-tools scripts are application agnostic, in order for the dashboard view to group hosts, we must inject some application specific information into the tags field. Tags is a collection of arbitrary strings. In the case of Riemann-tools scripts you can pass in arbitrary strings on the command line.

riemann-health --host 127.0.0.1 --tag "prod" --tag "webserver"

From Out of the Tar Pit:

The key problem with testing is that a test (of any kind) that uses one particular set of inputs tells you nothing at all about the behaviour of the system or component when it is given a different set of inputs. The huge number of different possible inputs usually rules out the possibility of testing them all, hence the unavoidable concern with testing will always be — have you performed the right tests?. The only certain answer you will ever get to this question is an answer in the negative — when the system breaks.

This is a strong argument for some form of generative, simulation, or property-based testing.