Skip to content

Instantly share code, notes, and snippets.

View brenapp's full-sized avatar
🐵
Code Wranglin

Brendan McGuire brenapp

🐵
Code Wranglin
View GitHub Profile
# isLeapYear - determines if the passed integer is a leap year
def isLeapYear(year):
isLeap = False
if year % 4 == 0:
isLeap = True
if year % 100 == 0:
isLeap = False
if year % 400 == 0:
isLeap = True
return isLeap
@brenapp
brenapp / flexbox.html
Created November 30, 2017 16:01
A super simple example of using flexbox as a column system
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Flexbox Grid</title>
<style>
main {
display: flex;
// Adj. Close for Each Month
let adj = [
30.550734,
29.040157,
28.25503,
32.47147,
28.410118,
30.476208,
30.281532,
28.305592,
@brenapp
brenapp / error.log
Created July 17, 2017 06:49
Linker Error
Invoking make in /Users/tim/Documents/Robotics/In The Zone...
CPC -I../include -I../src motors.cpp
LN ./bin/auton.o ./bin/init.o ./bin/motors.o ./bin/opcontrol.o ./bin/pid.o ./bin/robot.o ./firmware/libpros.a -lgcc -lm to bin/output.elf
./bin/motors.o:(.data+0x0): multiple definition of `motors::slewRates'
./bin/init.o:(.data+0x0): first defined here
./bin/motors.o:(.bss+0x0): multiple definition of `motors::slewTargets'
./bin/init.o:(.bss+0x240): first defined here
collect2: error: ld returned 1 exit status
make: *** [bin/output.elf] Error 1
The terminal process terminated with exit code: 1
@brenapp
brenapp / help.md
Last active March 27, 2017 21:51
Super small (150b) pub-sub with some cool features

Usage:

var ee = pub();
ee.on('*', (p, e) => console.log(`${e} trigged: ${p}`)); // Called for all events (returns all * listeners)
ee.on("load", d = (t, e) => console.log(`Page loaded in ${t}ms`)); // Returns an array of all listeners for that event (minus * listeners)
ee.emit("load", 2323); // Returns the return values of the .on() functions, in this order: [...specific listeners, ...* listeners]

ee.off("load", d); // Returns the new array of listeners

task autonomous() {
int sensor = getRotationalSensor();
while (sensor > 15) {
driveForward();
sensor = getRotationalSensor();
}
}
@brenapp
brenapp / naïve.c
Created February 21, 2017 18:40
The naïve approach to driving in autonomous
task autonomous() {
driveForward();
wait(8000);
stopDrive();
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
npm i -g express & curl -o /usr/local/bin/serve https://gist.githubusercontent.com/MayorMonty/98ccf4c976ef5f3b959be4f8ac228c31/raw/e895f30bf37858b52f92ad285eeafc35a2087549/serve.js
@brenapp
brenapp / grid.css
Created July 15, 2016 02:19
The Grid System from Skeleton, isolated from everything else
/**
* I did not make this, this is the grid system from the skeleton css framework, shamelessly ripped from their source!
* See the Skeleton Project here: <https://github.com/dhg/Skeleton> <http://getskeleton.com>
*/
.container {
position: relative;
width: 100%;
max-width: 960px;
margin: 0 auto;
padding: 0 20px;