Skip to content

Instantly share code, notes, and snippets.

View MrCookiefries's full-sized avatar
📚
Discovering what I want to do

Michael Copeland MrCookiefries

📚
Discovering what I want to do
View GitHub Profile
@MrCookiefries
MrCookiefries / one.md
Created November 20, 2021 01:44
Big O Notation Practice - SEC SU47

Step One: Simplifying Expressions

Simplify the following big O expressions as much as possible


  1. O(n + 10) -> O(n)

  2. O(100 * n) -> O(n)

@MrCookiefries
MrCookiefries / serial.py
Created July 15, 2021 04:01
SEC SU18 Python OOP
"""Python serial number generator."""
class SerialGenerator:
"""Machine to create unique incrementing serial numbers.
>>> serial = SerialGenerator(start=100)
>>> serial.generate()
100
@MrCookiefries
MrCookiefries / any7.py
Created July 11, 2021 02:33
SEC SU18 Python Syntax
def any7(nums):
"""Are any of these numbers a 7? (True/False)"""
# YOUR CODE HERE
for num in nums:
if num == 7:
return True
return False
@MrCookiefries
MrCookiefries / script.js
Created July 1, 2021 01:23
SEC SU12 OO-Challenge
class Vehicle {
constructor(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
honk() {
return "Beep";
}
@MrCookiefries
MrCookiefries / script.js
Created June 26, 2021 01:06
SEC SU10 MapsSets
const newSet = new Set([1,1,2,2,3,4]);
console.log(newSet);
// Set(4) {1, 2, 3, 4}
const newStr = [...new Set("referee")].join("");
console.log(newStr);
// "ref"
let m = new Map();
m.set([1,2,3], true);
@MrCookiefries
MrCookiefries / script.js
Created June 25, 2021 23:45
SEC SU10 Destructuring
// let facts = {
// numPlanets: 8,
// yearNeptuneDiscovered: 1846
// };
// let {
// numPlanets,
// yearNeptuneDiscovered
// } = facts;
// console.log(numPlanets);
@MrCookiefries
MrCookiefries / script.js
Created June 25, 2021 22:41
SEC SU10 Object-Enhancements
function createInstructor(firstName, lastName) {
return {
firstName,
lastName
};
}
const favoriteNumber = 42;
const instructor = {
@MrCookiefries
MrCookiefries / script.js
Created June 25, 2021 21:50
SEC SU10 Rest-Spread
const filterOutOdds = (...nums) => (
nums.filter(num => (num % 2))
);
const findMin = (...nums) => (
Math.min(...nums)
);
const mergeObjects = (obj1, obj2) => (
{...obj1, ...obj2}
@MrCookiefries
MrCookiefries / script.js
Created June 25, 2021 19:43
SEC SU10 Arrow-Functions
// Old code
/*
function double(arr) {
return arr.map(function(val) {
return val * 2;
});
}
*/
// New code
@MrCookiefries
MrCookiefries / global.js
Created June 25, 2021 03:31
SEC SU10 Let-Const
const PI = 3.14;
PI = 32; // Throws an error