Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mattjbray on github.
  • I am mattjbray (https://keybase.io/mattjbray) on keybase.
  • I have a public key ASD_93kPkXb3SWPtg44-JLYFnFz7WQw_M4S8p4fA5Rqn-Qo

To claim this, I am signing this object:

@mattjbray
mattjbray / index.html
Created December 5, 2016 11:52
UI Router resolvers with dependencies.
<html>
<head>
<meta charset="UTF-8"/>
<title>Document</title>
</head>
<body>
<script src="https://unpkg.com/angular/angular.js"></script>
<script src="https://unpkg.com/angular-ui-router/release/angular-ui-router.js"></script>
<script>
var app = angular.module('my-app', ['ui.router']);
{-# LANGUAGE RankNTypes #-}
newtype ListC a = ListC
{ foldC :: forall r. (a -> r -> r) -> r -> r
}
foldC' :: (a -> r -> r) -> r -> ListC a -> r
foldC' co ni (ListC f) = f co ni
isNil :: ListC a -> Bool
@mattjbray
mattjbray / thing.hs
Last active October 9, 2016 18:01
Servant URLs
type API = "users" :> (Capture "id" Int :> Get '[JSON] User
:<|> Get '[JSON] [User])
urlForUser :<|> urlForUsers = urlHelpersFor (Proxy :: Proxy API)
-- urlForUser :: Int -> URI
-- urlForUsers :: URI
@mattjbray
mattjbray / stack.yaml
Created August 30, 2016 19:43
Haskell-Stack configuration for building elm-lang.org
resolver: lts-6.14
packages:
- location: . # elm-lang.org itself
- location:
git: https://github.com/elm-lang/elm-compiler
commit: c9c7e72c424a13255f8ee84c719f7ef48b689c1a # 0.17
extra-dep: true
- location:
git: https://github.com/elm-lang/elm-package
@mattjbray
mattjbray / Main.elm
Last active May 11, 2016 08:36
Elm 0.17 error after removing onClick
module Main exposing (..)
import Html.App as Html
import Html exposing (..)
import Html.Events exposing (..)
main : Program Never
main =
Html.beginnerProgram
Vagrant.configure(2) do |config|
config.vm.box = "precise64"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "test-perms.yml"
end
end
@mattjbray
mattjbray / new_relic.rb
Created October 17, 2013 15:26
New Relic, Ruby, XMLRPC
::NewRelic::Agent.logger.info "Patching NetHTTPRequest for XMLRPC (in config/intializers/new_relic.rb)"
module NewRelic
module Agent
module HTTPClients
class NetHTTPRequest
def method
match = @request.body.match /<methodName>(.*)<\/methodName>/
if match
return match.captures.first
else
module Main where
import Test.HUnit
import System.Environment
main :: IO ()
main = do
words <- getArgs
@mattjbray
mattjbray / gist:4000998
Created November 2, 2012 12:18
Heroku Rails app logs - "Processing by" deferred
2012-11-02T11:51:50+00:00 app[web.1]:
2012-11-02T11:51:50+00:00 app[web.1]: Started GET "/" for 213.1.223.82 at 2012-11-02 11:51:50 +0000
2012-11-02T11:51:50+00:00 app[web.1]: cache: [GET /] miss
2012-11-02T11:51:50+00:00 app[web.1]:
2012-11-02T11:52:25+00:00 app[web.1]:
2012-11-02T11:52:25+00:00 app[web.1]:
2012-11-02T11:52:25+00:00 app[web.1]: Started GET "/" for 213.1.223.82 at 2012-11-02 11:52:25 +0000
2012-11-02T11:52:25+00:00 app[web.1]: cache: [GET /] miss
2012-11-02T11:52:33+00:00 app[web.1]:
2012-11-02T11:52:33+00:00 app[web.1]: