View molecules.rb
#!/usr/bin/env ruby
require 'csv'
require 'set'
## HA (hyaluronic acid) molecule merging script
## Written by Max Tagher, licensed to the Public Domain under Creative Commons Zero 1.0
### Overview
# This script runs a simulation of HA molecules merging with one another.
View main.hs
{-# LANGUAGE MultiWayIf #-}
module Main where
import Data.Time
import System.Random
import Control.Reaper
import Control.Concurrent
import Control.Monad
import Data.IORef
View ekg-yesod.md

Monitoring a Yesod app with EKG

Monitoring is critical to a well-functioning production system. OS-level metrics like CPU load and RAM usage are a good start, but you'll eventually want to record application-level metrics like how long it's taking you to service each HTTP request, or how much time is spent in garbage collection. Once tracked, this data can be used by humans and machines (like monitoring systems) to gain insight into how your app is running.

In this post I'll show how you can use EKG, a popular Haskell metrics library, to add application-level metrics to your Yesod app.

A Brief Overview of EKG Metric Types

EKG allows reporting four different types of metrics from your app:

View ekgjson.json
{
"myapp":{
"home_requests":{
"type":"c",
"val":0
}
},
"ekg":{
"server_timestamp_ms":{
"type":"c",
View redis-yesod.md

Connecting to Redis from Yesod

This is a quick run-through of how I connected to Redis from a Yesod site (which used the default scaffolding). There isn't much specific to Redis here, so this information should apply to connecting to any database or service from Yesod.

Background: Basics of Hedis

First, a brief intro of the basics of Hedis:

{-# LANGUAGE OverloadedStrings #-}
View gist:2a8b75cfbbdc0d59245f
Max@maximilians-mbp ~/D/i/C/S/H/5.0.2> pod spec lint --verbose --no-clean
HZInMobi (5.0.2) - Analyzing on iOS 6.0 platform.
Preparing
Analyzing dependencies
Fetching external sources
-> Fetching podspec for `HZInMobi` from `/Users/Max/Documents/iOS/CocoapodsSource/Specs/HZInMobi/5.0.2/HZInMobi.podspec`
View gist:51c99fff419ccd759e58
tree
.
├── HZInMobi
├── Headers
├── Local Podspecs
│   └── HZInMobi.podspec.json
├── Manifest.lock
├── Pods.xcodeproj
│   ├── project.pbxproj
│   └── xcuserdata
View gist:83e08c0b1ae20a1e62ea
Max@maximilians-mbp /t/C/S/H/5.0.2> pod spec lint --verbose --no-clean
WARN: Unresolved specs during Gem::Specification.reset:
json (>= 1.7.7, ~> 1.7)
minitest (~> 5.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
HZInMobi (5.0.2) - Analyzing on iOS 6.0 platform.
Preparing
View gist:c6c1efa0287de715edbe
while processing /Users/Max/Documents/iOS/ios-example-app/Chartboost.framework/Chartboost(CBTouchCallbackView.o):
warning: /Users/bob/Library/Developer/Xcode/DerivedData/Chartboost-dbglhohaluoolubfpjbzctgxcsdw/Build/Intermediates/PrecompiledHeaders/Chartboost-Prefix-gjlczopydjkegkafbxxfsnlbgwmm/Chartboost-Prefix.pch.pch: No such file or directory
while processing /Users/Max/Documents/iOS/ios-example-app/Chartboost.framework/Chartboost(CBTouchCallbackView.o):
warning: /Users/bob/Library/Developer/Xcode/DerivedData/Chartboost-dbglhohaluoolubfpjbzctgxcsdw/Build/Intermediates/PrecompiledHeaders/Chartboost-Prefix-gjlczopydjkegkafbxxfsnlbgwmm/Chartboost-Prefix.pch.pch: No object file for requested architecture
while processing /Users/Max/Documents/iOS/ios-example-app/Chartboost.framework/Chartboost(CBTouchCallbackView.o):
warning: Could not resolve external type c:objc(cs)UIView
while processing /Users/Max/Documents/iOS/ios-example-app/Chartboost.framework/Chartboost(CBTouchCallbackView.o):
warning: Could not resol
View gist:95f7b03f16b2de1a11cc
##########################################
#
# c.f. http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4
#
# Version 2.7
#
# Latest Change:
# - Supports iPhone 5 / iPod Touch 5 (uses Apple's workaround to lipo bug)
#
# Purpose: