Skip to content

Instantly share code, notes, and snippets.

View dearshrewdwit's full-sized avatar
🤖
17 is my number.

Edward Withers dearshrewdwit

🤖
17 is my number.
View GitHub Profile
character, value
, m
a, X
b, p
c, M
d, *
e, D
f, 3
g, £
h, §
@dearshrewdwit
dearshrewdwit / interview-extension4.md
Last active June 26, 2020 15:34
Letter Number encryption part 5

Details

We have a new requirement!

  1. Build a letter-letter substitution cipher.

Let's take this opportunity to refactor to take advantage of OOP's polymorphism. The public interface to all our ciphers should be methods #encrypt and #decrypt.

  • NB: Use character_set1 for the Letter Number cipher and character_set2 for the Letter Letter cipher
  • NB: Ciphers should assume a valid character set
@dearshrewdwit
dearshrewdwit / interview-extensions3.rb
Created June 23, 2020 15:19
letter-number encryption part 3
# Let's define a new class EncryptedSecret to represent the encrypted secret
# It has a public #decrypt method
# NB: The ciphertext produced by Secret#encrypt is composed of pairs of characters each representing an encrypted plaintext character.
## Test cases
cipher_text = Secret.new('Look over there!').encrypt(2374) # => '37141410981421041798190704170452'
p EncryptedSecret.new(cipher_text).decrypt(2374) #=> 'Look over there!'
# In short, we encrypt and decrypt with the same key and expect the original plaintext.
Rearrange your implementation to obey the following constraints
1. Each method can only have a maximum of 5 operations, where an operation is a variable assignment or a method call.
2. Each method can be a maximum of 5 lines (excluding method definition key words)
3. The only public method available should be Secret#encrypt (private methods are free to use).
Any amount of rearranging is fine, so long as the test cases still pass.
# Find part 1 here: https://gist.github.com/dearshrewdwit/7cd72cad258b8c043ed5237b3f41e9cb
# For this challenge use the character set here: https://gist.github.com/dearshrewdwit/691c71616995ad2430ab309aa9998745
# Copy or download the file locally to your project directory
# Your implementation should use your character set file and be agnostic to the values.
# NB: the charset mappings have changed slightly
# NB: plaintext = starting string. ciphertext = encrypted string
# NB: each encrypted plaintext character should never be more than two ciphertext characters.
# If the evaluation of the encrypted character value is > 99, then reset from 0 and continue adding.
character, value
, 1
a, 2
b, 3
c, 4
d, 5
e, 6
f, 7
g, 8
h, 9
@dearshrewdwit
dearshrewdwit / makers-part-time-course-outline.md
Last active June 29, 2020 13:49
Makers Part time - Course Outline

July2020 (Pilot)

  • Fundamentals: Monday 6th July - Saturday 1st August
  • Software Craft: Sunday 2nd August - Saturday 12th September*
  • 1 week break
  • Modern Web Development: Sunday 20th September - Saturday 28th November
  • 1 week break
  • Team Professional: Sunday 6th December - Monday 8th February 2021**

* Summer bank holiday: 31st Aug

@dearshrewdwit
dearshrewdwit / peer-advice-for-learning.md
Last active March 31, 2020 09:25
Advice from your peers: How to Succeed at Makers

Advice from your peers: How to Succeed at Makers

Here is some anonymised raw feedback data for the devs in cohorts since September 2018, added from the bottom - so scroll down for the most recent data.

They, as you will be, were asked a set of questions to reflect on at the end of the course.

Inquiry Project

  • Find a common theme in the feedback for each of the three questions presented and share your learnings with your peer group.
  • Consider adding a learning objective to a goal in your learning plan.

Tracking your learning

In self-directed learning, one of the important aspects is to keep track of your learning. By reflecting on what you have learnt and setting yourself goals on what to do next, you'll cement your understanding and focus your efforts.

  • The Portfolio Template is one tool you can use to set goals for yourself and keep track of the evidences of having achieved said goals.
  • -DEPRECATED-Diode is a tool that allows you to keeps notes of projects you are working on and link them to the goals of the course.
  • Here's a trello board you can copy to manage your goal tracking. It has a few example goals. https://trello.com/b/lBHn6hIt/student-goal-tracking

Other examples from Makers devs

@dearshrewdwit
dearshrewdwit / basic_class.rb
Created November 20, 2019 09:22
Re-implementing class in ruby
module BasicClass
def self.new(parent_klass = nil, &block)
klass = lambda do
class_scope = {
ancestry: [klass, self],
instance_methods: {},
methods: {
define: lambda { |name, &block| class_scope[:instance_methods][name] = block },
new: lambda do |*args|
instance = lambda do