Skip to content

Instantly share code, notes, and snippets.

View mmagician's full-sized avatar

Marti mmagician

View GitHub Profile
@mmagician
mmagician / pre-commit
Last active March 13, 2024 14:06 — forked from hryniuk/pre-commit-cargo-fmt
Git `pre-commit` hook that checks Rust code style with `cargo fmt`
#!/bin/bash
diff=$(cargo fmt -- --check)
result=$?
if [[ ${result} -ne 0 ]] ; then
cat <<\EOF
There are some code style issues, run `cargo fmt` first.
EOF
exit 1
@mmagician
mmagician / saveFigure.m
Created February 21, 2016 01:57 — forked from corydolphin/saveFigure.m
Saving figures in MATLAB as full size, not cutoff. Gets around issue of cutting off Title, etc. Slightly slow, but it works. Damnit MATLAB graphics library.
function [ output_args ] = saveFigure( handle, fileName )
% saveFigure
% Saves figure specified by `handle` as `fileName` in fullscreen
% as to get around the stupid behavior.
screen_size = get(0, 'ScreenSize');
origSize = get(handle, 'Position'); % grab original on screen size
set(handle, 'Position', [0 0 screen_size(3) screen_size(4) ] ); %set to scren size
set(handle,'PaperPositionMode','auto') %set paper pos for printing
saveas(handle, fileName) % save figure