Skip to content

Instantly share code, notes, and snippets.

View mwiegant's full-sized avatar

Max Wiegant mwiegant

  • Rockets are cool
  • Denver, CO
View GitHub Profile
@mwiegant
mwiegant / sample.cpp
Created February 6, 2020 20:32
C++, windows, get the information on all network interfaces
#include <winsock2.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <WS2tcpip.h>
// Link with Iphlpapi.lib
#pragma comment(lib, "IPHLPAPI.lib")
@mwiegant
mwiegant / init.js
Created November 15, 2019 08:03
One potential way to compact all the initialization stuff for CPE400's project
/*
NOTE: I am hesitant to use this potential design because I think it is harder to read. Since I am working with 2 others
who don't have the same level of Javascript experience, I think this code may be harder for them to understand.
*/
/*
initialization.js -- This file defines the things that should be done as soon as the web page initially loads.
Some things that need to be done at initialization:
@mwiegant
mwiegant / Request.rb
Created January 7, 2017 15:47
Ruby HTTP API for making web requests
require 'net/http'
require 'json'
require 'uri'
=begin
@about: API for making web requests
@author: Max Wiegant
@revisions:
[20161223] - First Draft
[20170107] - v1.0.0 completed
@mwiegant
mwiegant / dateProcessing.cpp
Created October 12, 2015 21:12
C++, date string processing functions
/*
* NOTE: I am not 100% sure these functions work as intended. They may serve
* as a useful place to start though if a problem involving data parsing needs
* to be solved.
*/
// --------------------------------------------
// Constants
// --------------------------------------------
const char JAN[4] = "JAN";
@mwiegant
mwiegant / panel.html
Last active October 3, 2015 00:40
A simple html Color Panel, built for teaching a friend about web development
<head>
<title>Color Panel Display</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<script src="panel.js"></script>
</head>
<body>
<div class="con">
<span class="panel" id="panel"></span>
@mwiegant
mwiegant / timer.html
Last active October 3, 2015 00:40
simple example timer, built for teaching a friend about web development
<head>
<title>Toggle Timer Page</title>
</head>
<body>
<p id="date">should not see this</p>
<br>
<p id="time">should not see this</p>
<br>
@mwiegant
mwiegant / flippanel.html
Last active October 3, 2015 00:41
An html page with responsive containers, built for teaching a friend about web development
<html>
<head>
<style>
div.panel {display:inline-block; width:100px; height:100px; border:3px solid black;
margin:20px}
div.on {background-color:blue;}
</style>
</head>
<body>
@mwiegant
mwiegant / example.cpp
Created September 23, 2015 21:47
How to pre-load an array with values
const Month JAN ( 0, "JAN" );
const Month FEB ( 1, "FEB" );
const Month MAR ( 2, "MAR" );
const Month APR ( 3, "APR" );
const Month MAY ( 4, "MAY" );
const Month JUN ( 5, "JUN" );
const Month JUL ( 6, "JUL" );
const Month AUG ( 7, "AUG" );
const Month SEP ( 8, "SEP" );
const Month OCT ( 9, "OCT" );
@mwiegant
mwiegant / convertCharToInt.cpp
Last active October 12, 2015 21:07
C++, How to convert a number from Char to Int
#include <iostream>
using namespace;
int main()
{
char charSix = '6';
// int intSix = int( charSix ) - 48; // DON'T DO THIS, Leverington calls this 'terrible code'
int intSix = int( charSix - '0');
cout << "The value of intSix is: " << intSix << endl;
@mwiegant
mwiegant / myGithubApi.js
Last active August 29, 2015 14:23
Use github api to remove old branches from github repositories
/* I used the npm module github-api, check it out.
npm -- https://www.npmjs.com/package/github-api
github -- https://github.com/michael/github
*/
var Github = require('github-api');
//------------------ API -------------------------
function API() {
// I assume you'll pass your username and password in as environment variables, which is probably the