Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Geske stungeye

View GitHub Profile
@stungeye
stungeye / random.md
Last active Sep 14, 2021
Random Number In Range
View random.md

A simple way to generate a random number in C++ is by using the rand() method.

Here's an application that prints out 10 random numbers from a user specified range:

int randomNumber(const int min, const int max) {
    const int range = max - min + 1;
    return rand() % range + min;
}
@stungeye
stungeye / instructions.md
Last active Sep 11, 2021
Configure OBS Studio to Record / Stream a Portion of Your Screen
View instructions.md

Want to Record / Stream a Portion of your Screen using OBS Studio?

  • Ensure you have a Display Capture source. (This source will default to capturing your entire display.)
  • Click on the Displau Capture source and hit CTRL-E to edit the scene transform.
  • Use the crop settings below (Crop Left, Right, Top, Bottom) to set the screen crop. You can also crop by ctrl-click-dragging the red points around the scene output preview.
  • Next go to the main OBS settings (above the exit button) and then to the Video settings section.
  • Change the Base and Output resolution to match the resolution of your cropped area.
  • You can now stream or record your cropped screen at full resolution.

It's also good to switch the Recoding Quality (in Output Settings) to Indistinguishable Quality to tame output file sizes.

@stungeye
stungeye / phonecall_tests.js
Last active Jun 15, 2021
Will you, Won't You Starter Code
View phonecall_tests.js
function passOrFail(predicate, expectation, msg) {
const outcome = (predicate == expectation) ? "PASSED" : "FAILED";
console.log(`${msg}: ${outcome}`);
}
function expect(predicate, msg) {
return {
toBeFalsy: () => passOrFail(predicate, false, msg),
toBeTruthy: () => passOrFail(predicate, true, msg)
}
@stungeye
stungeye / leap_test.js
Last active Jun 15, 2021
Leap Year Testing Code p5js
View leap_test.js
function passOrFail(predicate, expectation, msg) {
const outcome = (predicate == expectation) ? "PASSED" : "FAILED";
console.log(`${msg}: ${outcome}`);
}
function expect(predicate, msg) {
return {
toBeFalsy: () => passOrFail(predicate, false, msg),
toBeTruthy: () => passOrFail(predicate, true, msg)
}
@stungeye
stungeye / before_and_after_boxstarter.md
Last active Jun 6, 2021
Boxstarter Windows 10 Developer Setup - 2021 Edition
View before_and_after_boxstarter.md

Enable Windows Developer Mode

Open the Windows Settings app, search for Developer Mode and enable it.

Install Boxstarter

Run Powershell as Admin and execute:

Set-ExecutionPolicy Unrestricted -Force
. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
@stungeye
stungeye / ExpenseReport.cpp
Last active Dec 5, 2020
Advent Of Code Day 1 - C++
View ExpenseReport.cpp
#include "ExpenseReport.h"
#include <fstream>
#include <iostream>
namespace ExpenseReport {
// Reads each line of the input file in a set of unique integers.
// Note: Testing a set to see if it contains specific numbers is a very quick operation using find().
std::unordered_set<int> read_expense_report_file(const std::string& filename) {
std::ifstream input_file{filename};
@stungeye
stungeye / Horse.js
Created Nov 10, 2020
Copy Pasta for the Full Stack Masses
View Horse.js
// app/javascript/components/Horse.js
import React from "react";
export default function Horse(props) {
return (
<>
<div className="column is-one-third">
<div className="card">
<div className="card-image">
@stungeye
stungeye / horse.jsx
Created Nov 9, 2020
Horse Component HTML
View horse.jsx
<div className="column is-one-third">
<div className="card">
<div className="card-image">
<figure className="image is-square">
<img src={props.imageUrl} alt={props.name} />
</figure>
</div>
<div className="card-content">
<p className="title">
<a href={props.url}>{props.name}</a>
@stungeye
stungeye / styles.css
Last active Nov 6, 2020
To Do List Styles
View styles.css
.App {
padding: 2rem;
}
form input {
display: inline-block;
height: 3rem;
width: 65%;
margin-right: 5%;
}
View mean_kyle.js
(async function() {
// Fetch API data on world countries.
const url = 'https://gist.githubusercontent.com/stungeye/e34eee4f6665a077d320e15e2910b97a/raw/830c1a0125430d3b619ef438380e2e1fa874bf84/countries.json';
const apiResponse = await fetch(url);
// Parse response JSON into an array.
const countries = await apiResponse.json();
// Render the App component to the div#root in markup.
const root = document.getElementById("root");