{{ message }}

Instantly share code, notes, and snippets.

Taylor MandersonTRManderson

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)
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))
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):
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
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/)
Created Jan 28, 2015
.vimrc
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'
Created Feb 24, 2015
Map in C#
View map.cs
 static IEnumerable Map(this IEnumerable seq, Func f) { foreach (var t in seq) yield return f(t); }
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
Last active Jan 28, 2016
Repeatedly hit the Github status API to see if it's down or not (py2/3 compatible and cross-platform)
View check_gh.py
 from __future__ import print_function import requests import os import time if os.name == "posix": def sound(): os.system("play --no-show-progress --null --channels 1 synth 5 sin 440") else:
Created Feb 20, 2016
My AVR makefile for a uni course last year
View Makefile
 # Name: Makefile # Author: Tom Manderson # Based on https://github.com/obdev/CrossPack-AVR/ DEVICE = atmega324a CLOCK = 8000000 PROGRAMMER = -c avrispmkii OBJECTS = project.o buttons.o game.o ledmatrix.o score.o scrolling_char_display.o serialio.o spi.o terminalio.o timer0.o AVRDUDE = avrdude \$(PROGRAMMER) -p m324pa -F COMPILE = avr-gcc -Wall -Os -std=c99 -DF_CPU=\$(CLOCK) -mmcu=\$(DEVICE)
You can’t perform that action at this time.