Skip to content

Instantly share code, notes, and snippets.

View chrisengelsma's full-sized avatar

Chris Engelsma chrisengelsma

  • Houston, TX
  • 07:25 (UTC -05:00)
View GitHub Profile
@chrisengelsma
chrisengelsma / LinkedList.h
Last active October 7, 2019 17:00
C++17 Linked List Implementation
/**
* @class LinkedList
* @brief A simple linked list.
*
* A linked list is a data structure represented by a series of nodes wherein
* each node maintains a record of its stored value and a pointer to another
* node.
*
* This implementation is intended to provide very basic functionality,
* including insertion, deletion, and size.
@chrisengelsma
chrisengelsma / format-bytes.pipe.ts
Created February 25, 2019 06:05
Angular2+ Pipe to format bytes to human-legible units
import { Pipe } from '@angular/core';
/**
* Formats a byte value to a human-readable format.
*
* Example uses:
* -------------
* {{ value | formatBytes }} - use short units.
* {{ value | formatBytes: "long"}} - use long name units
*/
@chrisengelsma
chrisengelsma / PolynomialRegression.h
Last active February 28, 2024 14:07
Polynomial Regression (Quadratic Fit) in C++
#ifndef _POLYNOMIAL_REGRESSION_H
#define _POLYNOMIAL_REGRESSION_H __POLYNOMIAL_REGRESSION_H
/**
* PURPOSE:
*
* Polynomial Regression aims to fit a non-linear relationship to a set of
* points. It approximates this by solving a series of linear equations using
* a least-squares approach.
*
* We can model the expected value y as an nth degree polynomial, yielding
@chrisengelsma
chrisengelsma / pymod
Created April 5, 2017 16:03
Python module skeleton generator
#!/bin/bash
# Description: Creates a new python module skeleton in your project.
# Note: will exit if the directory already exists to prevent overwriting.
#
# usage: pymod MODULE_NAME
# example: $ pymod foo
# result: foo/
# |_ __init__.py
# |_ foo.py
#
@chrisengelsma
chrisengelsma / touch.cmd
Created March 2, 2017 19:32
"touch" script for Windows Command Prompt
@echo off
setlocal enableextensions disabledelayedexpansion
(for %%a in (%*) do if exist "%%~a" (
pushd "%%~dpa" && ( copy /b "%%~nxa"+,, & popd )
) else (
type nul > "%%~fa"
)) >nul 2>&1
@chrisengelsma
chrisengelsma / maths.scss
Created September 10, 2016 04:21
Basic sass math functions
// If for some reason you don't / can't use Compass...
@function pow($number, $exp) {
$value: 1;
@if $exp > 0 {
@for $i from 1 through $exp {
$value: $value * $number;
}
}
@else if $exp < 0 {