This file contains hidden or 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
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import logging | |
from urllib2 import Request, urlopen, URLError, HTTPError | |
from base64 import b64decode |
This file contains hidden or 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
# Today we'll be creating a Task List for an individual | |
# who has a lot of errands and tasks to complete and multiple | |
# locations or stores to go to in order to complete them. | |
# Create a class for a Task List. | |
# All TaskList instances should have an owner and a dute date | |
# passed in on creation. For instance, our owner could be "Tyler" | |
# and his due date would be "Sunday". The owner should not be | |
# changeable but you should be able to read it outside of the class. |
This file contains hidden or 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 encode | |
[reflector rotor-l rotor-m rotor-r letter] | |
(->> (letter-to-index letter) | |
(rotor-translate-left (rotate rotor-r 1)) | |
(rotor-translate-left rotor-m) | |
(rotor-translate-left rotor-l) | |
(reflect reflector) | |
(rotor-translate-right rotor-l) | |
(rotor-translate-right rotor-m) | |
(rotor-translate-right (rotate rotor-r 1) |
This file contains hidden or 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
class Letterpress | |
def self.run(board) | |
all_words = File.open('/usr/share/dict/words').readlines.map! { |line| line.strip.chomp } | |
valid_words = all_words.select { |w| w =~ /[^#{board.join}]/ } | |
valid_words = valid_words.select do |w| | |
bool = true | |
bool = false if w.size <= 2 | |
split_word = w.downcase.split('') |