This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Text.Regex.Gsub | |
(gsub) where | |
import Text.Regex.Posix ((=~), MatchText) | |
import Data.Array ((!)) | |
import Data.Char (isDigit) | |
------------------------------------------------------------------------------- | |
gsub :: String -> String -> String -> String | |
gsub text match replacement = replaceMatches 0 matches text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" let mapleader='\' | |
" When using \b on normal mode, it will compile the | |
" project | |
nmap <LEADER>b :<C-u>make<CR> | |
" Close the QuickFix window just with the q | |
au FileType qf nnoremap <buffer> q :<C-u>cclose<CR> | |
" After compiling, open the QuickFix window if there |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data RequesType | |
= GetRequest | |
| PutRequest ByteString | |
| MultipartPostRequest FileParams | |
| UrlEncodedPostRequest | |
| DeleteRequest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
let lineStartsWithPipe = getline('.') =~# '^\s*|' | |
let pipedContentOnPrevLine = getline(line('.')-1) =~# p | |
let pipedContentOnNextLine = getline(line('.')+1) =~# p | |
if exists(':Tabularize') && lineStartsWithPipe && (pipedContentOnPrevLine || pipedContentOnNextLine) | |
" Getting the number of pipes that are on the line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-| | |
This is where all the routes and handlers are defined for your site. The | |
'site' function combines everything together and is exported by this module. | |
-} | |
module Site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like. | |
# | |
# | |
# 30th March 2010: | |
# Added a check to make sure user is in the staff group. This was a problem | |
# for me, and I think it was due to me migrating my account over several | |
# versions of OS X. I cannot verify that for sure, and it was tested on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Proc | |
alias_method :old_call, :call | |
public | |
def curried? | |
!!@curried | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MultiParamTypeClasses, GeneralizedNewtypeDeriving #-} | |
import Data.Char | |
import Control.Monad | |
import Control.Monad.State | |
type ErrorMessage = String | |
data User = User { | |
name :: String | |
, age :: Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleInstances #-} | |
module Database.MongoDB.Extensions where | |
import Database.MongoDB hiding (find) | |
import Data.List (find) | |
import Control.Monad ((=<<)) | |
import Data.ByteString (ByteString) | |
import qualified Data.ByteString as B | |
instance Val (Maybe Value) where | |
val Nothing = Null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeSynonymInstances, NoMonomorphismRestriction #-} | |
module Iteratee where | |
import Control.Applicative hiding (many) | |
import Control.Monad (liftM, ap) | |
import Data.Char (isSpace, isAlpha) | |
import Data.Monoid | |
import qualified Prelude as P | |
import Prelude hiding (head, break) |