Skip to content

Instantly share code, notes, and snippets.

View MichaelSDavid's full-sized avatar
🐬
Just tech diving!

Michael David MichaelSDavid

🐬
Just tech diving!
View GitHub Profile
@MichaelSDavid
MichaelSDavid / SwiftUIPlayground.swift
Last active May 26, 2021 11:02
Basic SwiftUI template for Playgrounds
import SwiftUI
import PlaygroundSupport
struct ContentView: View {
var body: some View {
// Placeholder
Text("Hello World")
}
}
@MichaelSDavid
MichaelSDavid / factorial_iter.jai.cpp
Last active August 13, 2020 06:52
Factorial iterative procedure in Jai
#import "Basic";
// Cupcake compiler: #import "modules/Basic.jai";
#run main(); main :: () {
factorial :: (n : int) -> int {
// Iterative method
result : int = 1;
while (n > 1) {
result *= n;
@MichaelSDavid
MichaelSDavid / factorial_recur.jai.cpp
Last active May 10, 2021 23:40
Factorial recursive procedure in Jai
#import "Basic";
// Cupcake compiler: #import "modules/Basic.jai";
#run main(); main :: () {
factorial :: (n : int) -> int {
// Recursive method
if (n == 1) {
return n;
} else {
return n * factorial(n - 1);
@MichaelSDavid
MichaelSDavid / daily_int_pro_08-20-2020.py
Created August 20, 2020 20:52
Daily Interview Pro example solution for shifted string problem on 08/20/2020
def is_shifted(a, b):
shift_list = []
def shift(n, s):
tmp = [char for char in s]
shift_str = ''.join(tmp[-n:] + tmp[:-n])
return shift_str
for i in range(1, len(a)):
shift_list.append(shift(i, a))
@MichaelSDavid
MichaelSDavid / PasswordGenerator.java
Last active September 1, 2020 00:15
Multility password generator backend
package com.matdevtech.multility;
// Imports
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@MichaelSDavid
MichaelSDavid / Notepad.java
Last active September 1, 2020 00:30
Multility notepad backend
package com.matdevtech.multility;
// Imports
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
@MichaelSDavid
MichaelSDavid / military_time.py
Last active September 4, 2020 22:57
SoloLearn Code Coach solution for Military Time in Python
sample_string = input()
def military_time(twelvehour_str):
if "PM" in twelvehour_str:
if len(twelvehour_str) == 8:
initial_hour = twelvehour_str[:2]
new_hour = int(initial_hour) + 12
final24_str = str(new_hour) + twelvehour_str[2:5]
else:
initial_hour = twelvehour_str[0]
@MichaelSDavid
MichaelSDavid / military_time.cpp
Created September 4, 2020 22:57
SoloLearn Code Coach solution for Military Time in C++
#include <iostream>
#include <string>
using namespace std;
int main() {
string twelve_hr_str;
string initial_hr;
int new_hr;
string final_24_str;
@MichaelSDavid
MichaelSDavid / bulkRemoveWLVideos.js
Created September 4, 2020 23:43
Console script to bulk remove "Watch Later" videos on YouTube (requires old layout)
// Old view in WL: https://www.youtube.com/playlist?list=WL&disable_polymer=true
var timer = window.setInterval(function() {
var videoDeleteButton = document.querySelector('.pl-video-edit-remove')
if (videoDeleteButton) {
videoDeleteButton.click()
setTimeout(function() {
document.querySelector('.yt-uix-load-more').click()
}, 5000)
} else {
window.clearInterval(timer)
@MichaelSDavid
MichaelSDavid / challenge18.py
Created September 9, 2020 02:02
Challenge #18 solution for TWT Discord
# Only requires the function for submission
def solution(k):
r,y = [],[]
m = 1
while m <= k:
if m % 2 == 0:
r.append(m ** 2)
else:
y.append(m ** 2)