This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static IEnumerable<R> Map<T, R>(this IEnumerable<T> seq, Func<T, R> f) | |
{ | |
foreach (var t in seq) | |
yield return f(t); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
OlderNewer