Skip to content

Instantly share code, notes, and snippets.

Tom Manderson TRManderson

Block or report user

Report or block TRManderson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@TRManderson
TRManderson / printout.py
Created Dec 11, 2015
Simple decorator to print evaluation result
View printout.py
def printout(f):
from functools import wraps
@wraps(f)
def g(*args, **kwargs):
r = f(*args, **kwargs)
print f.__name__+":",r
return r
return g
View map.cs
static IEnumerable<R> Map<T, R>(this IEnumerable<T> seq, Func<T, R> f)
{
foreach (var t in seq)
yield return f(t);
}
View gist:9249f3c761671a547ab7
set nocompatible
filetype off
set hidden
set wildmenu
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
"Bundle 'powerline/powerline', {'rtp': 'powerline/bindings/vim/'}
Bundle 'scrooloose/nerdtree'
Plugin 'bling/vim-airline'
@TRManderson
TRManderson / graph.png
Last active Aug 29, 2015
In a meta-post on Lesswrong, Metus suggested someone plot a curve of comments over time, so I did. (see here: http://lesswrong.com/r/discussion/lw/lev/short_meta_should_open_threads_be_more_frequent/)
@TRManderson
TRManderson / Sum-Them-Digits.hs
Last active Dec 16, 2015
Solution to Reddit's r/dailyprogrammer challenge #122 [Easy] (Sum them digits) Haskell re-implementation of RDP-122-E.py
View Sum-Them-Digits.hs
#http://www.reddit.com/r/dailyprogrammer/comments/1berjh/040113_challenge_122_easy_sum_them_digits/
digitalRoot :: Integer -> Integer
digitalRoot n = if (n `mod` 9 == 0 && n > 0) then 9 else n `mod` 9
@TRManderson
TRManderson / Sum-Them-Digits.py
Last active Dec 16, 2015
Solution to Reddit's r/dailyprogrammer challenge #122 [Easy] (Sum them digits)
View Sum-Them-Digits.py
#http://www.reddit.com/r/dailyprogrammer/comments/1berjh/040113_challenge_122_easy_sum_them_digits/
def digitalRoot(number):
if number <= 10:
if number==10:
return 1
else:
return number
else:
digitSum=0
for i in str(number):
@TRManderson
TRManderson / Bytelandian-Exchange-2.py
Last active Dec 16, 2015
Solution to Reddit's r/dailyprogrammer challenge #121 [Intermediate] (Bytelandian Exchange 2)
View Bytelandian-Exchange-2.py
#http://www.reddit.com/r/dailyprogrammer/comments/1a7ca0/031313_challenge_121_intermediate_bytelandian/
def maxValue(coin):
if coin<=1:
return coin
else:
return max(coin,maxValue(coin/2)+maxValue(coin/3)+maxValue(coin/4))
@TRManderson
TRManderson / Bytelandian-Exchange-1.py
Last active Dec 16, 2015
Solution to Reddit's r/dailyprogrammer challenge #121 [Easy] (Bytelandian Exchange 1)
View Bytelandian-Exchange-1.py
#http://www.reddit.com/r/dailyprogrammer/comments/19mn2d/030413_challenge_121_easy_bytelandian_exchange_1/
def coins (inputCoin):
if inputCoin == 0:
return 1
else:
return coins(inputCoin//2)+coins(inputCoin//3)+coins(inputCoin//4)
You can’t perform that action at this time.