Skip to content

Instantly share code, notes, and snippets.

View chreekat's full-sized avatar

Bryan Richter chreekat

View GitHub Profile
@chreekat
chreekat / keybase.md
Created February 26, 2018 16:40
more keybase proof D:

Keybase proof

I hereby claim:

  • I am chreekat on github.
  • I am chreekat (https://keybase.io/chreekat) on keybase.
  • I have a public key ASA0oicw7-38n2VbjiH3SGa8_gZGAo8g8EIvHOCYGxELrAo

To claim this, I am signing this object:

@chreekat
chreekat / hackagedocs
Last active January 2, 2016 08:49 — forked from Fuuzetsu/hackagedocs
#!/bin/bash
set -e
read -p "Package name: " package
read -p "Version: " version
read -p "Hackage user: " user
read -sp "Hackage password (not echoed): " password
echo "== BUILDING WITH DOCS"
@chreekat
chreekat / gist:7884116
Last active December 30, 2015 20:59
How to compile BaroboLabHack on Ubuntu 12.04

Date: Monday Dec. 9, 2013

  1. Add repositories holding newer versions of g++ and qt.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
sudo apt-add-repository ppa:ubuntu-sdk-team/ppa &&
sudo aptitude update &&
sudo aptitude safe-upgrade
@chreekat
chreekat / gist:6980016
Last active December 25, 2015 12:59
Creating Angular Controller from Fay Module: API brainstorm

Here's what I'm using to generically build a controller out of a Fay module.

# CoffeeScript

angModule = angular.module("angModule", [])

angModule.controller("FooCtl", ($scope) ->
        $scope[k] = v for own k, v of Strict.HaskModule
)
@chreekat
chreekat / hello_fay.hs
Last active December 25, 2015 05:29
Fay FFI Hello World / Tutorial
{-# LANGUAGE EmptyDataDecls #-}
-- This is a literate file, for some value of 'literate'.
--
-- Read the comments. Read the code. Enjoy. :)
import Prelude
import FFI
-- | Meme-appropriate starting point. We use javascript to make fay which
@chreekat
chreekat / gist:5965830
Last active December 19, 2015 13:59
QuickCheck'ing values in Template Haskell's Q monad.
{-# LANGUAGE TemplateHaskell #-}
-- An example of testing TH-generated thingadoohickies.
--
-- Using the standard QuickCheck module, there is no direct way to test
-- values generated with Template Haskell functions, most of which end up
-- in the Q monad. This little writeup describes how to test those values
-- using the module Test.QuickCheck.Monadic.
--
-- For this example, you can ignore the doohickies being generated. I just
filter('fooLink', function () {
return function(g, curId) {
if (g.id === curId) {
return g.name;
} else {
return '<a href="/foo/' + g.id + '">' + g.name + '</a>';
}
}});
@chreekat
chreekat / nictest.patch
Created February 7, 2012 22:25
Nictest
diff --git a/Foundation.hs b/Foundation.hs
index f054558..ef71bd9 100644
--- a/Foundation.hs
+++ b/Foundation.hs
@@ -22,6 +22,7 @@ import Yesod.Auth.GoogleEmail
import Yesod.Default.Config
import Yesod.Default.Util (addStaticContentExternal)
import Yesod.Logger (Logger, logMsg, formatLogText)
+import Yesod.Form.Nic
import Network.HTTP.Conduit (Manager)
@chreekat
chreekat / 2012-02-02-fun-with-yesod-authorization.md
Created February 2, 2012 20:33
"Blog" 2012-02-02: More fun with Yesod authorization

I was inspired by Felipe Lessa's post about abstracting Yesod permissions. Thanks for writing it, Felipe! I had only just discovered isAuthorized, and that post made me all the more excited to go about refactoring my authorization code.

Unfortunately I had a little trouble working Felipe's method into my own project. This was probably due in no small part to my too-recent discovery of isAuthorized and the AuthResult type. After much tinkering, I narrowed the difficulties down to just one (and a half) points of contention:

@chreekat
chreekat / auto-generated-models.js
Created January 3, 2012 20:39
Example of auto-generated Model definitions
YUI().use('model', function (Y) {
// Auto-generated from a 'Person' object in the back end
Y.PersonModel = Y.Base.create('personModel', Y.Model, [], {}, {
ATTRS: {
name: {},
email: {}
}
});