Skip to content

Instantly share code, notes, and snippets.

Tom Prats tomprats

Block or report user

Report or block tomprats

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tomprats
tomprats / after_cd_todo
Created May 12, 2017
RVM hook for printing out TODOs when switching to a directory
View after_cd_todo
#!/usr/bin/env bash
for file in ./TODO*; do
if [ -f $file ]; then
name=$(basename $file)
echo "######################### $name "#########################
cat $file
echo "######################### $name "#########################
fi
done
@tomprats
tomprats / csv_splitter.rb
Last active Sep 25, 2015
Split a large CSV into smaller CSVs specifying the max rows per file
View csv_splitter.rb
require "csv"
def split_csv(file, max)
csv = CSV.read(file, headers: true)
csv_headers = csv.headers
total_files = ((csv.length - 1)/max.to_f).ceil
max = max.to_i
csv = csv.to_a
name = file.split(".csv")[0]
path = "./csv/"
You can’t perform that action at this time.