Skip to content

Instantly share code, notes, and snippets.

View ChristopherBiscardi's full-sized avatar
💭
Building stuff

Chris Biscardi ChristopherBiscardi

💭
Building stuff
View GitHub Profile
#!/usr/bin/perl
# A script to generate constraints based on the package versions installed
# in a cabal sandbox.
#
# Like cabal freeze / cabal-constraints, but is not limited to a single
# package or build tree.
#
# For this to work, you have either to be in a directory with
# cabal.sandbox.config, or have the environment set up
# Install a local copy of Hoogle (OS X, HP)
# Download
cd
cabal unpack hoogle
cd hoogle-4.2.26/
# Build
cabal sandbox init
cabal install -j --dependencies-only
@ChristopherBiscardi
ChristopherBiscardi / Data.Haxl.Postgres.DataStoreExample.hs
Created July 5, 2014 01:44
A naive Haxl example Postgres DataStore
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Data.Haxl.Postgres.DataStoreExample
data PersonError = PersonError
{ name :: Maybe [NameError]
, email :: Maybe [EmailError]
, age :: Maybe [AgeError]
} deriving Show
@ChristopherBiscardi
ChristopherBiscardi / gist:00ef2342253e97fae70a
Created September 21, 2014 19:05
Switching GHC Versions
ghc783(){
# Add GHC 7.8.3 to the PATH, via http://ghcformacosx.github.io/
export GHC_DOT_APP_7_8_3="/Applications/ghc-7.8.3.app"
if [ -d "$GHC_DOT_APP_7_8_3" ]; then
export PATH="${HOME}/.cabal/bin:${GHC_DOT_APP_7_8_3}/Contents/bin:${PATH}"
fi
}
@ChristopherBiscardi
ChristopherBiscardi / .zshrc
Created January 3, 2015 19:19
docker run emacs
e () {
if [ $(git rev-parse --is-inside-work-tree 2>/dev/null) ]
then
if [[ -n $1 && ( -a $1 || -d $1 ) ]]
then
FULLPATH=$1:A
GITPATH=$(git rev-parse --show-toplevel)
GIT_PATH_LENGTH=${#GITPATH}
EDIT_FILE_PATH=$FULLPATH[$GIT_PATH_LENGTH+2,${#FULLPATH}]
docker run -itv $(git rev-parse --show-toplevel):/files biscarch/emacs emacs /files/$EDIT_FILE_PATH
FROM alpine:latest
RUN apk add --update curl xz alpine-sdk perl gmp-dev file gmp openssh openssl
RUN cd /tmp && su -l operator -c "curl -o /tmp/ghc.xz 'http://10.11.12.2:8000/ghc-7.10.1-x86_64-unknown-linux-musl.tar.xz'"
RUN su -l operator -c "cd /tmp && xz -c -d /tmp/ghc.xz | tar xf -"
RUN cd /tmp/ghc-7.10.1 && ./configure --prefix=/opt && make install
RUN echo 'main = putStrLn "Hello static world"' > /tmp/static.hs
@ChristopherBiscardi
ChristopherBiscardi / _raw-input.css
Last active August 29, 2015 14:27
cssnano rule removal
@import 'dux/css/colors.css';
.flexTable {
display: flex;
flex-flow: column;
justify-content: center;
border: 1px solid var(--secondary-5);
border-radius: 3px;
font-size: 1rem;
margin: 0.5rem 0;
@ChristopherBiscardi
ChristopherBiscardi / gatsby.config.js
Created January 20, 2016 19:02
Extracting Stylesheets with Gatsby
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = function(config, env) {
if(env === 'static') {
config.removeLoader('css');
config.loader('css', function(cfg) {
cfg.test = /\.css$/;
cfg.loader = ExtractTextPlugin.extract('css?minimize');
return cfg
})

React-Relay depends on an exact-version of babel-relay-plugin as a peerDependency

babel-relay-plugin depends on an exact-version of graphql-js

Using npm3, you can do one of two things if you want to use graphql in your application.

  1. Keep an exact-match of the graphql dependency in babel-relay-plugin in your package.json
  2. Not include graphql as a dependency, which will cause babel-relay-plugin to cause the installation of graphql. This provides more flexibility to the application at the risk of no longer having explicit dependencies.