Skip to content

Instantly share code, notes, and snippets.

@ah45
ah45 / .profile
Last active August 29, 2015 14:01 — forked from blowmage/.profile
ohmygems
# configure the Ruby Gems environment
export RUBYOPT=rubygems
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
export PATH="$HOME/.gem/bin:$PATH"
source ~/bin/ohmygems
@ah45
ah45 / user-data
Created September 26, 2014 14:45
CoreOS user-data file for a cluster running Progrium's service discovery tools (consul, registrator, and ambassadord)
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
# WARNING: replace each time you 'vagrant destroy'
discovery: https://discovery.etcd.io/new
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
fleet:
@ah45
ah45 / gist:59051b1a1fa5d1de74f1
Created October 9, 2014 11:47
ActiveDirectory objectGUID decoding
(ns active-directory.guid.util
(:require [clojure.string :as str]
[clojure.data.codec.base64 :as b64]))
(defn decode
"Decodes a Base64 encoded string into a sequence of bytes"
[b64s]
(b64/decode (.getBytes b64s)))
(defn byte->hex
@ah45
ah45 / nested_map_zipper.clj
Created March 6, 2015 13:04
Editing Nested Maps from the bottom up with Clojure Zippers
(ns nested-map-zipper
(:require [clojure.zip :as zip]
[clojure.data :refer [diff]]))
(defmacro recur-if
([expr]
`(recur-if ~expr nil))
([expr else]
`(let [temp# ~expr]
(if temp# (recur temp#) ~else))))
@ah45
ah45 / defmethods.clj
Created March 18, 2015 15:48
defmethods macro
(defmacro defmethods
"A convenience over writing lots of short `defmethod` statements that
use the same arguments:
(defmulti mm (fn [o x y] o))
(defmethods mm [_ x y]
'+ (+ x y)
'- (- x y)
'* (* x y)
'/ (/ x y))
@ah45
ah45 / transit-xhr.cljs
Created April 17, 2015 14:14
Clojurescript Transit XHR Handler
(ns thoth.transit-xhr
(:require [cljs-time.format :as tf]
[cognitect.transit :as tr]
[com.cognitect.transit.types :as trt]
[goog.events :as events])
(:import [goog.net XhrIo]))
(def http-methods
"The HTTP request codes we support Transit payloads in."
{:get "GET"
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim p As Integer
For i = 1 To Worksheets.Count
If (Worksheets(i).Name <> "Data") Then
For p = 1 To Worksheets(i).PivotTables.Count
Worksheets(i).PivotTables(p).PivotCache.Refresh
Next p
End If
@ah45
ah45 / railway_oriented_programming.clj
Last active January 16, 2024 13:31
Railway Oriented Programming in Clojure using (funcool) Cats
(ns railway-oriented-programming
"An adaptation of [Railway Oriented Programming](rop) using the
[Cats](cats) library in Clojure.
[rop]: http://fsharpforfunandprofit.com/posts/recipe-part2/
[cats]: https://github.com/funcool/cats"
(:require [cats.builtin]
[cats.core :as cats]
[cats.monad.either :as either]))
@ah45
ah45 / Capacity Planning Problem Definition.md
Created November 7, 2016 10:53
Constraint Based Scheduling

Following on from a meeting with Simon, Ed, and Bryan. It seems like we’re trying to answer two questions:

  • Where are we overloaded?
  • What aren't we using? (That we should look to find or fit work to.)

Different contexts:

  • Managing current load
  • Always starts with released shop orders.

F# SPA Live Development

Pieces of the puzzle:

  • F#
  • Fable
  • Webpack
  • Suave / Freya / the .NET web framework of your choice