Skip to content

Instantly share code, notes, and snippets.

View ahmedsakr's full-sized avatar
💻
Coding from home

Ahmed Sakr ahmedsakr

💻
Coding from home
  • Wealthsimple
  • Ottawa, ON, Canada
View GitHub Profile
@ahmedsakr
ahmedsakr / Medium.py
Created August 3, 2020 04:38
A simple approach to overriding string output of an object
class Medium(object):
def __init__(self, username, age, interests):
self.username = username
self.age = age
self.interests = interests
def __str__(self):
'''
We swap the default string output of this class with an informative
@ahmedsakr
ahmedsakr / NumberTuple.py
Created August 3, 2020 04:16
A class that extends the immutable tuple
class NumberTuple(tuple):
'''
NumberTuple is a tuple class that wishes to convert
string number to a tuple.
'''
def __init__(self, number):
'''
While our goal is to convert the string number
@ahmedsakr
ahmedsakr / transform.js
Created August 1, 2020 16:19
Implementation of transform.js for the simple MD5 Hash application
// ES6 import right from node modules
// Parcel js will take care of bundling this for us so it's web ready.
import md5 from 'md5'
export function transform() {
document.getElementById('md5-output').value = md5(document.getElementById('md5-input').value);
}
@ahmedsakr
ahmedsakr / stickman.py
Created February 25, 2015 14:19
stickman game!
import random
import sys
# parallel lists, potential_words & potential_words_type. The word and it's type respectively.
potential_words = ["League of legends", "Gone Girl", "Runescape"]
potential_words_type = ["Game", "Movie", "Game"]
letters_to_guess = {}
# revealed_indicies list is used to check whether the certain index of the word has been guessed