Skip to content

Instantly share code, notes, and snippets.

View mhallin's full-sized avatar

Magnus Hallin mhallin

  • Stockholm, Sweden
View GitHub Profile
@mhallin
mhallin / App.re
Created August 6, 2018 11:45
Async import pattern
PageModule.fetchModule("./MyComponent")
|> Js.Promise.then_(m => send(SetRootElement(m())));
module Query1 = [%graphql
{|
query {
someFieldWithInterfaceType {
id
...on ImplA {
a_only
}
...on ImplB {
b_only
@mhallin
mhallin / mod.rs
Created September 20, 2017 15:05
R2D2, Diesel, Postgres, and Juniper
pub struct Ctx {
pub db: request::PooledConnection,
}
impl Context for Ctx {}
pub fn context_factory(req: &mut Request) -> Ctx {
Ctx {
db: request::get_db(req),
}