Skip to content

Instantly share code, notes, and snippets.

@oxbowlakes
oxbowlakes / 3nightclubs.scala
Created May 13, 2011 15:14
A Tale of 3 Nightclubs
/**
* Part Zero : 10:15 Saturday Night
*
* (In which we will see how to let the type system help you handle failure)...
*
* First let's define a domain. (All the following requires scala 2.9.x and scalaz 6.0)
*/
import scalaz._
import Scalaz._
@kaleb
kaleb / XDG.vim
Last active January 17, 2022 23:16
VIM XDG Configuration
" XDG Environment For VIM
" =======================
"
" References
" ----------
"
" - http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
" - http://tlvince.com/vim-respect-xdg
"
if empty($XDG_CACHE_HOME)
@klange
klange / _.md
Last active May 23, 2024 13:45
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
@mageekguy
mageekguy / gist:4713903
Last active January 5, 2017 21:07
Add code below in your .vimrc to see the Git previous version of the current file with :GitPrevious.
function! s:GitPrevious()
let _ = './' . expand('%')
let filetype = &filetype
execute ':silent! vsp ' . tempname()
execute ':silent! 0r !git show HEAD~1:' . _
execute ':silent! $d'
execute ':silent! set nomodifiable'
execute ':silent! set readonly'
execute ':silent! set ft=' . filetype
import Control.Monad
import Control.Applicative
import Control.Proxy
import System.IO
import Prelude hiding (Left, Right)
data Input = Up | Down | Left | Right | Invalid deriving Show
toInput :: Char -> Input
toInput c = case c of
import Control.Monad
import Control.Applicative
import Control.Proxy
import qualified Control.Proxy.Trans.State as S
import System.IO
import Prelude hiding (Left, Right)
type Pos = (Int, Int)
data Input = Up | Down | Left | Right | Invalid deriving Show
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):

A guide on syn region and conceal.

First, when is it appropiate to use syn region instead of syn match? As a rule of thumb: whenever you would expect the matched text to span several lines (and you don't know how many). If you see yourself using .* in the middle of a syn match rule, you should probably consider using syn region instead.

So let's suppose we want to highlight "{{{begin ... end}}}" blocks, such as this:

{{{begin "But I must explain to you how all this mistaken idea of

@addyosmani
addyosmani / README.md
Last active July 24, 2024 10:54 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@chrisdone
chrisdone / AnIntro.md
Last active March 24, 2024 21:13
Statically Typed Lisp

Basic unit type:

λ> replTy "()"
() :: ()

Basic functions: