Skip to content

Instantly share code, notes, and snippets.

View saevarb's full-sized avatar

Sævar Berg saevarb

  • NTT Data BS Nordics
  • Odense, Denmark
View GitHub Profile
data RedditJsonReply a where
GoodJsonReply :: FromJSON a => a -> RedditJsonReply a
BadJsonReply :: FromJSON a => [Text] -> RedditJsonReply a
errors :: RedditJsonReply a -> [Text]
errors (BadJsonReply e) = e
errors _ = error "Used 'errors' on GoodJsonReply."
reply :: RedditJsonReply a -> a
reply (GoodJsonReply a) = a
if !has('python')
echo "Error: Chronos needs vim compiled with python support."
finish
endif
python << EOF
import vim
import time
timerDict = {}
statsDict = {}
! urxvt settings
URxvt.urgentOnBell: true
URxvt.internalBorder: 0
URxvt.jumpScroll: true
URxvt.perl-lib: /usr/lib/urxvt/perl
URxvt.perl-ext-common: keysym-list,keyboard-select,selection,default,matcher,searchable-scrollback,url-select,clipboard
URxvt.keysym.C-i: perl:url-select:select-next
URxvt.keysym.M-Escape: perl:keyboard-select:activate
URxvt.keysym.M-s: perl:keyboard-select:search
URxvt.keysym.M-c: perl:clipboard:copy
int trimString(string &str) {
// TODO: Optimize
while (1) {
if (str.empty()) break;
if (str[0] == ' ') str.erase(0, 1);
else if (str[0] == '\r') str.erase(0, 1);
else if (str[0] == '\n') str.erase(0, 1);
else break;
}
; SeeBorg 0.51 beta settings file
; Lines beginning with ; or # are treated as comments
; Address of IRC server
server =
; Server port
serverport = 6667
; Bot's nickname
nickname = SeeBorg
autocmd BufWritePost *.hs SyntasticCheck
let g:syntastic_aggregate_errors = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_haskell_checkers = ['hdevtools', 'hlint']
@saevarb
saevarb / .vimrc
Last active August 29, 2015 14:06
" Autosave on focus lost
autocmd FocusLost * silent! :wa
" map leader to comma
let mapleader=","
" Change split navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Always show status bar(airline)
@saevarb
saevarb / bar.py
Created September 22, 2014 18:08
foo = ["foo", "FOO", "foO"]
foo = map(lambda s: s.lower(), foo)
s = set(foo)
for e in s:
print e
#include <iostream>
#include <cctype>
using namespace std;
class Person
{
public:
Person(char* newName, int newAge) : name(newName), age(newAge) { }
% Always zero elements of any element in the empty list
count(_, [], 0).
count(E, L, C) :- count(E, L, C, 0).
% This means that the count of the empty list is simply whatever
% is in the accumulator when the list is empty.
count(_, [], Acc, Acc).
count(E, [X|L], C, Acc) :- count(E, L, C, Acc).
count(X, [X|L], C, Acc) :-
Y is Acc + 1, count(X, L, C, Y).