Skip to content

Instantly share code, notes, and snippets.

View davidjpfeiffer's full-sized avatar

David Pfeiffer davidjpfeiffer

  • Theta Lake
  • Santa Barbara, CA
View GitHub Profile
@davidjpfeiffer
davidjpfeiffer / breakpoints-v-1
Last active June 2, 2016 13:17
SASS mixin to generate breakpoints for a given style
// Breakpoint Variables
$xs-break: em(400px);
$sm-break: em(600px);
$md-break: em(800px);
$lg-break: em(1000px);
$xl-break: em(1200px);
// Size Suffixes
$xs-suffix: "-xs";
$sm-suffix: "-sm";
@davidjpfeiffer
davidjpfeiffer / breakpoints-v-2
Created June 2, 2016 13:16
This solution does not actually work, but is extremely close (one character off) from efficiently generating breakpoints with more control than version 1.
// Breakpoint Variables
$xs-break: em(400px);
$sm-break: em(600px);
$md-break: em(800px);
$lg-break: em(1000px);
$xl-break: em(1200px);
// Size Suffixes
$xs-suffix: "-xs";
$sm-suffix: "-sm";
@davidjpfeiffer
davidjpfeiffer / chart-js-bar-example.html
Last active July 25, 2016 22:13
This HTML file can be used with Chart JS to create a fully-functional example of the chart.
<!doctype html>
<html>
<head>
<title>Chart Example</title>
<script src="chart.js"></script>
</head>
<body>
<div style="width: 50%">
@davidjpfeiffer
davidjpfeiffer / chart-js-doughnut-example.html
Last active July 25, 2016 22:10
This HTML file can be used with Chart JS to create a fully-functional example of the chart.
<!doctype html>
<html>
<head>
<title>Chart Example</title>
<script src="chart.js"></script>
</head>
<body>
<div style="width: 50%">
@davidjpfeiffer
davidjpfeiffer / chart-js-line-example.html
Last active July 25, 2016 22:10
This HTML file can be used with Chart JS to create a fully-functional example of the chart.
<!doctype html>
<html>
<head>
<title>Chart Example</title>
<script src="chart.js"></script>
</head>
<body>
<div style="width: 50%">
@davidjpfeiffer
davidjpfeiffer / chart-js-pie-example.html
Last active July 25, 2016 22:10
This HTML file can be used with Chart JS to create a fully-functional example of the chart.
<!doctype html>
<html>
<head>
<title>Chart Example</title>
<script src="chart.js"></script>
</head>
<body>
<div style="width: 50%">
@davidjpfeiffer
davidjpfeiffer / chart-js-polar-area-example.html
Last active July 25, 2016 22:10
This HTML file can be used with Chart JS to create a fully-functional example of the chart.
<!doctype html>
<html>
<head>
<title>Chart Example</title>
<script src="chart.js"></script>
</head>
<body>
<div style="width: 50%">
@davidjpfeiffer
davidjpfeiffer / chart-js-radar-example.html
Last active July 25, 2016 22:09
This HTML file can be used with Chart JS to create a fully-functional example of the chart.
<!doctype html>
<html>
<head>
<title>Chart Example</title>
<script src="chart.js"></script>
</head>
<body>
<div style="width: 50%">
@davidjpfeiffer
davidjpfeiffer / diningPhilosophers.c
Last active January 4, 2022 10:01
Resource hierarchy solution to the dining philosophers problem using POSIX threads and semaphores
/**
Dining Philosophers Problem
Written by David J Pfeiffer
Solution Name: Resource Hierarchy
Compile on UNIX system: gcc -o main -std=c99 main.c -lpthread
**/
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
@davidjpfeiffer
davidjpfeiffer / static-vs-dynamic-methods.cpp
Created December 6, 2017 16:49
A comparison of execution times for a static method and a dynamic method in C++
#include <iostream>
#include <cstdlib>
#include <Windows.h>
#include <limits.h>
using namespace std;
class Base
{
public: