Skip to content

Instantly share code, notes, and snippets.

View lukesims's full-sized avatar
🍪
Eating cookies

Luke Sims lukesims

🍪
Eating cookies
View GitHub Profile
@lukesims
lukesims / README.md
Last active February 14, 2020 11:13
MySQL Export to CSV with Column Headings and Dynamic Filename

Export a MySQL Query's Results to CSV with Column Headings and a Dynamic Filename

If we want to generate a CSV file directly from MySQL with column headings as the first row and a filename generated dynamically in the script, there are a few caveats which this snippet covers. These are described in full in long.sql amongst the comments and references.

  • long.sql - The script with all the comments and explanation of what/why.
  • short.sql - The script that has no comments and is as brief as possible to be used as a template.

Usage

  1. Copy short.sql to a new .sql file in a location that is readable by the user running the MySQL process.
@lukesims
lukesims / .gitignore
Created October 17, 2016 22:26
OctoberCMS .gitignore
# ------------------------------------------------------------------------------
# .gitignore for OctoberCMS (http://octobercms.com/)
# Based on https://gist.github.com/salcode/b515f520d3f8207ecd04 for WordPress
# ------------------------------------------------------------------------------
# By default all files are ignored.
#
# At the end of the file you will need to whitelist themes and plugins you want
# to include in the repo.
#
# Update the {PLACEHOLDERS} to reflect your setup.