Skip to content

Instantly share code, notes, and snippets.

View mattkenefick's full-sized avatar
🏠
Working from home

Matt Kenefick mattkenefick

🏠
Working from home
View GitHub Profile
/**
* Usage:
*
* const ratio = approximateAspectRatio(855, 482, 20);
* // "16:9"
*
* @param number width
* @param number height
* @param number maxRatio
* @return string
<section class="view-${input.filename}">
My Template
</section>
@mattkenefick
mattkenefick / index.html
Last active November 6, 2023 14:40
Ultra Generic Website Starter Kit
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: black;
color: white;
font-family: sans-serif;
}

Composition and inheritance are both fundamental concepts in object-oriented programming (OOP) that help in organizing and structuring code. While they achieve similar goals, they differ in their approach and usage. Here's a comparison between composition and inheritance:

Composition:

  1. Composition is a design principle that allows objects to be composed of other objects or components.
  2. It emphasizes building complex functionality by combining simpler, reusable components.
  3. It follows the "has-a" relationship, where an object contains or is composed of other objects.
  4. Components can be dynamically composed or changed at runtime, providing flexibility and modularity.
  5. Composition promotes code reusability, as components can be shared across different objects.
  6. It encourages loose coupling between objects, making the system more maintainable and adaptable.
  7. Composition can lead to a more modular and flexible code structure, as components can be easily replaced or modified without affecting the ent
@mattkenefick
mattkenefick / .bash_profile
Created February 9, 2023 14:53
Convert a file or directory into webp files from jpg, jpeg, or png
#
# Convert a file, or folder, into webp
# Example:
# toWebp splash-01.png
# toWebp splash-01.jpg
# toWebp splash-01.jpeg
# toWebp ./images
# toWebp
#
@mattkenefick
mattkenefick / bookmarklet
Last active February 5, 2023 17:19
Wraps your website in a visually simulated iPhone
javascript:(function(){ const script = document.createElement('script'); script.src = 'https://buck-web-javascript.s3.us-west-2.amazonaws.com/iphone-simulator/simulate-iphone.js'; document.body.appendChild(script); })();
@mattkenefick
mattkenefick / gist:a856ee60dfca78b6306acbe909531b8b
Created January 18, 2023 15:37
Setup a new PS1 for Powershell
# code $profile
function Write-BranchName () {
try {
$branch = git rev-parse --abbrev-ref HEAD
if ($branch -eq "HEAD") {
# we're probably in detached HEAD state, so print the SHA
$branch = git rev-parse --short HEAD
@mattkenefick
mattkenefick / .env.example
Created January 2, 2023 18:09
List of available Supabase ENV options
SITE_URL=''
OPERATOR_TOKEN=null
DISABLE_SIGNUP=false
RATE_LIMIT_HEADER=null
JWT_EXP=3600
JWT_AUD=''
JWT_DEFAULT_GROUP_NAME=''
URI_ALLOW_LIST=''
MAILER_AUTOCONFIRM=false
MAILER_OTP_EXP=86400
Hello. My dog's name is Roger.
git log -1 --pretty=%D HEAD | sed 's/.*origin\///g;s/, .*//g'