Skip to content

Instantly share code, notes, and snippets.

View mindbat's full-sized avatar
🍻
explicit is better than implicit

Ron Toland mindbat

🍻
explicit is better than implicit
View GitHub Profile
@mindbat
mindbat / vimrc
Created January 29, 2013 23:00
vimrc file
set number
set ts=2
set expandtab
nnoremap <tab> %
vnoremap <tab> %
nnoremap ; :
let mapleader = ","
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
@mindbat
mindbat / emacs
Last active December 11, 2015 22:18
emacs startup file
(setq make-backup-files nil)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq standard-indent 4)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
(setq c-basic-offset 4)
(autoload 'paredit-mode "paredit"
"Minor mode for pseudo-structurally editing Lisp code." t)
@mindbat
mindbat / drupal-vhost
Created January 29, 2013 23:09
sample virtual host entry for drupal on apache
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName drupal
DocumentRoot /var/www/drupal
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
@mindbat
mindbat / php-lint-script
Created June 7, 2013 00:12
Quickly run php lint against a directory of files
find <directory> -type f -name '*php' -print0 | xargs -0 -n1 -P10 php -l
@mindbat
mindbat / format.sd
Last active December 18, 2015 05:29
Sed script for re-formatting php files Use: sed -r -f format.sd -i <path/to/file/to/reformat>
# swap tabs for spaces
s/\t/ /g
# ensure spaces around =>
s/([^ ])=>([^ ])/\1 => \2/g
# remove trailing whitespace
s/ +$//g
# ensure spaces around .
@mindbat
mindbat / safe.hs
Last active December 21, 2015 08:18
Versions of the head, tail, etc functions that are safe to use on empty lists
safeHead :: [a] -> [a]
safeHead x = take 1 x
safeTail :: [a] -> [a]
safeTail x = drop 1 x
safeInit :: [a] -> [a]
safeInit x = take ((length x) - 1) x
safeLast :: [a] -> [a]
@mindbat
mindbat / elm-day-2-count-mouse-moves.elm
Created October 15, 2016 19:49
Elm Day 2: Count Mouse Moves
import Html exposing (Html, text, div)
import Html.App as App
import Mouse exposing (..)
main = App.program { init = init,
view = view, update = update, subscriptions = subscriptions }
-- Model
type alias Model = { count: Int }
@mindbat
mindbat / elm-day-2-count-mouse-clicks.elm
Created October 15, 2016 19:54
Elm Day 2: Count Mouse Clicks
import Html exposing (Html, text, div)
import Html.App as App
import Mouse exposing (..)
main = App.program { init = init,
view = view, update = update, subscriptions = subscriptions }
-- Model
type alias Model = { count: Int }
@mindbat
mindbat / elm-day-2-track-click-position.elm
Created October 15, 2016 20:30
Elm Day 2: Track Click Position
import Html exposing (Html, text, div)
import Html.App as App
import Mouse exposing (..)
main = App.program { init = init,
view = view, update = update, subscriptions = subscriptions }
-- Model
type alias Model = { x: Int, y : Int }
@mindbat
mindbat / elm-day-2-echo-text.elm
Created October 16, 2016 12:07
Elm Day 2: Echoing Text
import Html exposing (Html, text, input, div)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import String
main = App.program { init = init,
view = view, update = update, subscriptions = \_ -> Sub.none }
-- Model