Skip to content

Instantly share code, notes, and snippets.

View mattcdavis1's full-sized avatar

Matt Davis mattcdavis1

View GitHub Profile
@cognitom
cognitom / quickstart.js
Last active June 4, 2024 04:16
Unspaghetti version of Google Spreadsheet API example code
import {readFile, writeFile, mkdir} from 'mz/fs'
import readline from 'mz/readline'
import promisify from 'es6-promisify'
import google from 'googleapis'
import googleAuth from 'google-auth-library'
import clientSecret from './client_secret.json'
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/sheets.googleapis.com-nodejs-quickstart.json
const SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@andrewwoods
andrewwoods / resources.md
Last active December 16, 2016 16:15
PHP resources

PHP Resources

This gist has been converted to a repository called PHP Resoures Repo that you can fork and pull request to your heart's content!

May your coffee always be warm, your code always work, and the force be with you

@mattclements
mattclements / function.php
Last active October 29, 2024 22:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
// # Anatomy of a Javascript Module
// *for newer modules, see:* [ES2015 Javascript Module](https://gist.github.com/btpoe/55470d6b4b8bfca56e8f)
// ## The Constructor
// First, define a constructor function. The goal is to keep this function as lightweight as
// possible. For the first argument, we're going to receive an HTMLElement. This element is
// critical because it is essentially the key to this module instance. The second argument is all
// of the developer defined options for this particular instance. For any option used, we should
// declare a default (seen below) to prevent the module from breaking if certain options are not
// provided.
@erikreagan
erikreagan / mac-apps.md
Created August 4, 2012 19:18
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/