Skip to content

Instantly share code, notes, and snippets.

View purcell's full-sized avatar

Steve Purcell purcell

View GitHub Profile
@purcell
purcell / .slate
Last active February 7, 2018 20:57
Slate config
# See https://github.com/jigish/slate#readme
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config focusPreferSameApp false
config focusCheckWidthMax 3000
config checkDefaultsOnLoad true
config windowHintsShowIcons true
config windowHintsSpread true
@purcell
purcell / application_helper.rb
Created September 9, 2011 09:23
Make will_paginate generate HTML that bootstrap.less will render nicely
# Based on https://gist.github.com/1182136
class BootstrapLinkRenderer < ::WillPaginate::ActionView::LinkRenderer
protected
def html_container(html)
tag :div, tag(:ul, html), container_attributes
end
def page_number(page)
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
@purcell
purcell / migrations.sql
Last active September 16, 2017 10:10
PostgreSQL schema migrations system
This code now lives in its own repo at https://github.com/purcell/postgresql-migrations
module Puzzle where
import Data.List (permutations)
import Control.Monad (guard)
solution = do
[a,b,c,d,e,f] <- permutations "123456"
guard $ multiple 6 [a,b,c,d,e,f]
guard $ multiple 5 [a,b,c,d,e]
guard $ multiple 4 [a,b,c,d]
module Main where
import Text.Parsec
import Text.Parsec.String
main :: IO ()
main = do
input <- getLine
@purcell
purcell / elpa-compare.el
Created June 27, 2012 12:42
Compare melpa and marmalade package lists
(defun elpa/package-names (archive-name)
(let* ((archive-contents (expand-file-name (concat "archives/" archive-name "/archive-contents")
package-user-dir))
(names (mapcar 'car (rest (pb/read-from-file archive-contents)))))
(sort names 'string<)))
(defun list-minus (a b)
(let ((result (copy-seq a)))
(dolist (e b)
(delq e result))
@purcell
purcell / no-proxy-mode.el
Created October 25, 2013 09:23
no-proxy-mode.el
;;; no-proxy-mode.el --- Temporarily disable built-in proxy settings
;; Copyright (C) 2013 by Sachin Patil
;; Author: Sachin Patil <isachin@iitb.ac.in>
;; URL: http://github.com/psachin/proxy-mode
;; Keywords: network, proxy, tool, convenience
;; Version: 0.9
;; This file is NOT a part of GNU Emacs.
@purcell
purcell / proxy-mode.el
Created October 24, 2013 14:03
proxy-mode.el
;;; proxy-mode.el --- Provides proxy minor mode.
;; Copyright (C) 2013 by Sachin Patil
;; Author: Sachin Patil <isachin@iitb.ac.in>
;; URL: http://github.com/psachin/proxy-mode
;; Keywords: network, proxy, tool, convenience
;; Version: 0.9
;; This file is NOT a part of GNU Emacs.
@purcell
purcell / ensime-byte-compilation.txt
Created October 17, 2013 12:53
Ensime byte compilation warnings / errors
Compiling file /Users/steve/.emacs.d/elpa/ensime-20130904.40/ensime-auto-complete.el at Thu Oct 17 13:49:57 2013
Entering directory `/Users/steve/.emacs.d/elpa/ensime-20130904.40/'
In ensime-ac-complete-action:
ensime-auto-complete.el:148:11:Warning: reference to free variable `candidate'
In ensime-ac-enable:
ensime-auto-complete.el:322:15:Warning: assignment to free variable
`ac-delete-dups'
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config focusPreferSameApp false
config focusCheckWidthMax 3000
config checkDefaultsOnLoad true
alias air 1440x900
alias dell 2560x1440