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
#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/ |
// # 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. |
<?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; | |
} |
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
# 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 | |
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'] |