Skip to content

Instantly share code, notes, and snippets.

View ejdanderson's full-sized avatar
🗿
mostly

Evan Anderson ejdanderson

🗿
mostly
  • College Park, MD
View GitHub Profile
@ejdanderson
ejdanderson / update-url.js
Created June 6, 2017 22:22
Add/remove query parameters to the URL bar
updateParams : function() {
$('.class').on('change', function(e) {
e.preventDefault();
let url = window.location.pathname;
if ( $(this).prop('checked') ) {
let query_string = this.buildParamStr('param-name', 'param-value', true);
window.history.pushState('old-ai-state', '', url + query_string);
} else {
let query_string = this.buildParamStr('ai_fwp_filter', null, false);
window.history.pushState('old-ai-state', '', url + query_string);
@ejdanderson
ejdanderson / sort_eig.m
Created September 19, 2021 22:29
Sort via descending order for eig in MATLAB (real values)
[V, D] = eig(A);
[nuDiag,order] = sort(diag(D),'descend');
D = diag(nuDiag);
V=V(:,order);
@ejdanderson
ejdanderson / hatch_color.py
Created April 11, 2026 00:33
Decouple Hatch Color and Edge Color Matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
def hatch_bar(ax, x, y, hatch='///', hatch_color='blue',
edge_color='black', lw=1.5, **kwargs):
bars = ax.bar(
x, y,
facecolor='white',
edgecolor=hatch_color,