Skip to content

Instantly share code, notes, and snippets.

View stephenjbarr's full-sized avatar

Stephen Jeffrey Barr stephenjbarr

View GitHub Profile
@benhsu
benhsu / collect-ips.el
Created January 17, 2013 04:33
code to grab all the strings matching a given regex and put them in a buffer, along with sample use for IPs
(defun collect-regexp-results (regex)
;;; collects all the matches of regex in a buffer called *collect-result*
;;; then switches to that buffer
;;; TODO refactor this to take the region as a parameter
(interactive "Mregex to search for: ")
(let ((curmin (region-or-buffer-beginning))
(curmax (region-or-buffer-end)))
(save-excursion
(goto-char curmin)
;; (goto-char (region-or-buffer-beginning))
(defun wc/narrow-window ()
(let (( new-right
(max 0 (+ (or (cdr (window-margins)) 0)
(- (window-body-width) fill-column)))))
(set-window-margins nil (car (window-margins)) new-right)
(set-window-fringes nil (car (window-fringes)) 2)))
(define-minor-mode wrap-column-mode
"Wrap the text at `fill-column'.
Works by adjusting the right margin."
@cwvh
cwvh / .ghci
Last active December 23, 2015 15:39
Read header comment on how to setup.
{-
Place contents of this file in $HOME/.ghci then run
$ cabal install -j2 hoogle
$ hoogle data
-}
let ghciEscapeShellArg arg = "'" ++ concatMap (\c -> if c == '\'' then "'\"'\"'" else [c]) arg ++ "'"
:def! h return . (":! hoogle --color --count=20 " ++) . ghciEscapeShellArg
@drwebb
drwebb / HaskellR.hs
Created September 7, 2015 16:37
GGplot in Haskell
demographicsAnalysis :: (MonadIO m, H.MonadR m) => Frame User -> m ()
demographicsAnalysis fr = do
let demographics = fmap (rcast :: User -> Record '[HaskellExperience
,RecommendHaskell
,Occupation])
(nubbed, counts) = view (runGetter ((,) <$> Getter (_1) <*> Getter _2))
(unzip
(sortByLens (_1.recommendHaskell)
(sortByLens (_1.haskellExperience)
@NathanHowell
NathanHowell / stack.yaml
Created February 3, 2016 06:28
GHC 8.0 release candidate stack/stackage yaml
resolver: ghc-8.0.0.20160111
setup-info:
ghc:
linux64:
8.0.0.20160111:
url: "http://downloads.haskell.org/~ghc/8.0.1-rc1/ghc-8.0.0.20160111-x86_64-deb7-linux.tar.xz"
content-length: 111404852
sha1: 30d39c6ca6994dcafe25595e053035ad23198b52
macosx:
8.0.0.20160111:
module SignupForm exposing (..)
-- This is where our Elm logic lives.`module SignupForm` declares that this is
-- the SignupForm module, which is how other modules will reference this one
-- if they want to import it and reuse its code.
-- Elm’s "import" keyword works similarly to "require" in node.js.
import Html exposing (..)
@Icelandjack
Icelandjack / Notation.markdown
Last active July 6, 2019 18:37
Notes on Notation

Non-standard operators I use :) linked to from my twitter profile

I use kind synonyms

type T   = Type
type TT  = T -> T
type TTT = T -> TT
type C   = Constraint
type TC  = T -> C
@maxkfranz
maxkfranz / index.html
Last active March 29, 2021 09:58
cytoscape-dagre demo
<!DOCTYPE>
<html>
<head>
<title>cytoscape-dagre.js demo</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
@geoff-parsons
geoff-parsons / live-update-chartjs.html
Created June 1, 2013 05:36
Example of live updating Chart.js charts.
<!DOCTYPE html>
<html>
<head>
<title>Chart.js Redraw Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="chart.min.js"></script>
<script type="text/javascript" charset="utf-8">
window.chartOptions = {
segmentShowStroke: false,
@snoyberg
snoyberg / .emacs
Last active June 5, 2021 23:04
Michael Snoyman's .emacs file: Stack, haskell-mode, evil-mode
;; Get package installation ready
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; Theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(load-theme 'zenburn t)