Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Geske stungeye

View GitHub Profile
@stungeye
stungeye / pi.rb
Created Jul 23, 2022
Sonic Pi Demo
View pi.rb
live_loop :bass_drum do
##| sample :bd_haus
sample :bd_haus, cutoff: 70, amp: 4
sleep 0.5
end
live_loop :amen_break do
##| sample :loop_amen, beat_stretch: 2
@stungeye
stungeye / code_of_conduct.md
Last active Jul 19, 2022
Sound + Code = Jam 🎶 Code of Conduct
View code_of_conduct.md

Why Have a Code of Conduct?

We want all attendees to be able to focus their full attention on learning and creating at this event. This is impossible to do if you are being harassed or discriminated against. Accordingly, all attendees are expected to show respect and courtesy to each other in all interactions.

To make sure that everyone has a common understanding of “show respect and courtesy to each other,” we have adopted the following code of conduct.

Sound + Code = Jam 🎶 Code of Conduct

The Sound + Code = Jam event is committed to providing a friendly, safe and welcoming environment for all, regardless of gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or another similar characteristic.

@stungeye
stungeye / header.h
Created Apr 12, 2022
Shape and Derived Shapes
View header.h
// Define a new class called Shape
//
// Properties of Shape:
// - color (ofColor) // ofColor::cadetBlue
// - position (glm::vec2) // {0, 0}
//
// Constructor that takes in a ofColor and a glm::vec2
// and uses those parameters to initial the properties.
//
@stungeye
stungeye / main.cpp
Created Apr 5, 2022
Base and Derived Classes and Objects in C++ (With References and Pointers)
View main.cpp
#include <iostream>
#include <string>
class Base {
protected:
int value{0};
public:
Base(int value) : value{value} {
std::cout << "Base Constructor\n";
}
@stungeye
stungeye / main_with_pointer.cpp
Last active Jun 1, 2022
Has-As Class Relationship with and without Pointers
View main_with_pointer.cpp
/*
Imagine this code was written before initializer lists. (Pre C++11)
When compared with `main_without_pointer_oldskool_and_broken.cpp`:
- Point's location member is a pointer to a Location.
- Location does not need a default constructor.
- The location member is only constructed once.
*/
#include <iostream>
@stungeye
stungeye / instructions.md
Created Feb 4, 2022
Getting Started with Eleventy using WSL 2
View instructions.md

Getting Started with Eleventy using WSL 2

  1. Install WSL and enable WSL2.
  2. Ensure everything is up to date from the WSL prompt:
    sudo apt update 
    sudo apt upgrade
    sudo apt install build-essential
    
  3. Install Node: curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash
View lambda.cpp
#include <iostream> // std::cout
#include <string> // std::string
#include <vector> // std::vector
#include <algorithm> // std::count_if, std::adjacent_find, std::sort
#include <numeric> // std::accumulate
#include <functional> // std::function
#include <array> // std::array
void printIt(const std::function<int(const std::string& word)>& fnc, const std::string& word) {
std::cout << fnc(word) << "\n";
@stungeye
stungeye / binary_files.cpp
Created Jan 20, 2022
Reading and Writing Strings From a Binary File
View binary_files.cpp
// ExploringFiles.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <filesystem>
#include <fstream>
#include <vector>
#include <string>
View money.cpp
class Money{
static constexpr int centsPerDollar{100};
int mDollars{0};
int mCents{0};
// Ensure that we never have more than 99 cents.
void rollCentsIntoDollars() {
int additionalDollars = mCents / Money::centsPerDollar;
mDollars += additionalDollars;
mCents %= Money::centsPerDollar;
View ExploringFiles.cpp
#include <iostream>
#include <filesystem>
#include <fstream>
#include <vector>
int main() {
std::cout << "CWD: " << std::filesystem::current_path() << "\n";
std::ifstream inputFile{"data.txt"};