Skip to content

Instantly share code, notes, and snippets.

@ruslantalpa
ruslantalpa / thoughts.md
Last active October 16, 2015 14:32
Thoughts on SQL backend/resolver for GraphQL server

We want to get back this result

{
	project: {
		id: 1,
		name: "First Project",
		description: "Create a cool website",
		client: {
			id: 1,
			name: "First Client"
@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active April 19, 2025 14:26
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

import Control.Monad.Logic
import Control.Monad.Trans.Maybe
zipLogic :: (MonadLogic m) => m a -> m b -> m (a, b)
zipLogic gx gy =
maybe mzero return <=< runMaybeT $ do
(x, rx) <- MaybeT (msplit gx)
(y, ry) <- MaybeT (msplit gy)
lift $ return (x, y) `mplus` zipLogic rx ry
@djspiewak
djspiewak / streams-tutorial.md
Created March 22, 2015 19:55
Introduction to scalaz-stream

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

@bdha
bdha / gist:c456cf6e5484ea5ad256
Last active August 29, 2015 14:15
Building Haskell on SmartOS
@prestonp
prestonp / query.sql
Created October 16, 2014 17:21
postgres update return new values and old values
-- returning updated values and old values by using a sub-expression
update orders
set type = 'delivery'
where id = 3767
returning id, type, (
select type from orders where id = 3767
) as old_type;
@tel
tel / PipeLog.hs
Last active January 13, 2018 10:03
Pipes-based logger
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module PipeLog where
import Control.Applicative
import Data.Functor.Identity
import Pipes
import qualified Pipes.Prelude as P
newtype LogT l m a =
@AlainODea
AlainODea / bootstrap.sh
Last active January 26, 2019 17:34
WIP: SmartOS installing Haskell Cabal 1.16.1.0 (look at install_cabal.sh)
#!/bin/sh
set -o xtrace
# A script to bootstrap cabal-install.
# It works by downloading and installing the Cabal, zlib and
# HTTP packages. It then installs cabal-install itself.
# It expects to be run inside the cabal-install directory.
# install settings, you can override these by setting environment vars
@pascalpoitras
pascalpoitras / 1.md
Last active May 1, 2025 10:42
My WeeChat configuration

This configuration is not maintained anymore. You should think twice before using it, Breaking change and security issue will likely eventually happens as any abandonned project.

@mattratleph
mattratleph / vimdiff.md
Last active March 17, 2025 13:07 — forked from roothybrid7/vimdiff_cheet.md
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)