Skip to content

Instantly share code, notes, and snippets.

@davidmh
davidmh / config.fish
Last active November 28, 2020 13:37
Showing git branch in fish shell prompt. Put following code at the end of ~/.config/fish/config.fish. It will also highlight in red if branch is dirty. Based on http://zogovic.com/post/37906589287/showing-git-branch-in-fish-shell-prompt
set fish_git_dirty_color red
set fish_git_not_dirty_color green
function parse_git_branch
set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
set -l git_status (git status -s)
if test -n "$git_status"
echo (set_color $fish_git_dirty_color)$branch(set_color normal)
else
@afreeland
afreeland / gist:8184438
Last active November 11, 2021 11:45
JavaScript: CSV Get Headers from input stream using ArrayBuffer
function CSVImportGetHeaders()
{
// Get our CSV file from upload
var file = document.getElementById('CSVUpload').files[0]
// Instantiate a new FileReader
var reader = new FileReader();
// Read our file to an ArrayBuffer
reader.readAsArrayBuffer(file);