Skip to content

Instantly share code, notes, and snippets.

View ofelix03's full-sized avatar

Felix Otoo ofelix03

View GitHub Profile
@ofelix03
ofelix03 / tailwind-functional-css.html
Created April 10, 2021 21:25
tailwind-functional-css
<article class="bg-green-50 w-2/3 px-8 py-10 rounded-xl m-10 shadow-md">
<h1 class="text-4xl mb-2 text-yellow-900 font-extrabold">The Brawl Between Semantic CSS and Functional CSS</h1>
<div class="font-semibold mb-3 text-yellow-700">10th April, 2021</div>
<div class="text-gray-700 text-lg">
<p>The Web has experienced a lot since its creation by Tim Berners-Lee.
You can consider remarkable events like the formation of W3C, the classic browser wars,
the formation of WaSP, the ceding of XHTML and HTML 4.0 standards to HTML5 and many other events.
</p>
</div>
</article>
@ofelix03
ofelix03 / string-concatenations-with-comma-delimters-bad.py
Last active April 11, 2021 00:22
string-concatenations-with-comma-delimeters-bad
names = ['Samuel Mensah', 'Thomas Fynn', 'George Stone']
names_str = ""
for name in names:
names_str += name + ", "
names_str = names_str.rstrip(", ")
print("names_str: ", names_str)
@ofelix03
ofelix03 / string-concatenations-with-comma-delimeters-better.py
Created April 11, 2021 00:00
string-concatenations-with-comma-delimeters-better
names = ['Samuel Mensah', 'Thomas Fynn', 'George Stone']
names_str = ", ".join(names)
print("names_str: ", names_str)
@ofelix03
ofelix03 / if-checks-on-truthy-values.py
Created April 11, 2021 00:09
if-checks-on-truthy-values
invoice = Invoice(amount=2000,
invoice_date='2021-04-30',
customer=' Toyota Motor Corporation',
number='INV-20001')
if invoice.is_due is True:
# send a followup report to customer
pass
@ofelix03
ofelix03 / if-checks-on-truthy-values-better.py
Last active April 17, 2021 03:03
if-checks-on-truthy-values-better
invoice = Invoice(amount=2000,
invoice_date='2021-04-30',
customer=' Toyota Motor Corporation',
number='INV-20001')
if invoice.is_due:
# invoice id due, send a followup report to customer
pass
@ofelix03
ofelix03 / raising-exceptions-inside-if-conditionals-bad.py
Last active April 17, 2021 03:01
raising-exceptions-inside-if-conditionals-bad
if something_is_wrong:
raise Exception("Something is wrong")
else:
# perform appropriate action
pass
@ofelix03
ofelix03 / raising-exceptions-inside-if-conditionals-better.py
Created April 11, 2021 00:17
raising-exceptions-inside-if-conditionals-better
if something_is_wrong:
raise Exception("Something is wrong")
# perform appropriate action
@ofelix03
ofelix03 / raising-exceptions-inside-if-conditionals-better.py
Last active April 11, 2021 00:24
raising-exceptions-inside-if-conditionals-better
if something_is_wrong:
raise Exception("Something is wrong")
# perform appropriate action
@ofelix03
ofelix03 / summation-using-for-loop-bad.py
Last active April 11, 2021 00:32
summation-using-for-loop-bad
allocation_amounts = [120.0, 320.30, 420.0, 100.0]
total_allocation = 0
for amount in allocation_amounts:
total_allocation = total_allocation + amount
print("total_allocation: ", total_allocation)
@ofelix03
ofelix03 / summation-using-for-loop-better.py
Last active May 7, 2021 07:45
summation-using-for-loop-better
allocation_amounts = [120.0, 320.30, 420.0, 100.0]
print("total_allocation: ", sum([allocation_amounts]))