Skip to content

Instantly share code, notes, and snippets.

View cobbman's full-sized avatar
🏠
Working Remotely

William cobbman

🏠
Working Remotely
View GitHub Profile
@devwax
devwax / mysql_snippets.sql
Last active September 17, 2021 05:13
MySQL snippets
### Queries for replacing strings in MySQL database records
- https://www.webhostface.com/kb/knowledgebase/mysql-search-replace/
UPDATE `wp_options` SET option_value = REPLACE(option_value, 'newdev/', '') WHERE `option_value` LIKE '%newdev/%' LIMIT 1;
- Regular expression
SELECT * FROM tablename WHERE meta_key REGEXP '^wp_([0-9]+)_' limit 10;
### MySQL dump specific rows, etc
-- Run in bash terminal, not in mysql> cli
@devwax
devwax / devwax-commands.sh
Last active May 4, 2024 00:34
Bash Terminal Commands
# copy dir contents to another dir
# https://askubuntu.com/a/86891
cp -a source/. dest/
# https://docs.gitlab.com/ee/user/ssh.html
ssh-keygen -t ed25519 -C "<comment>"
# SSH Public Key Setup
Copy public key to clipboard
pbcopy < ~/.ssh/id_rsa.pub

Raise Open File Limits in OS X

in OS X 10.4 to macOS sierra 10.12 and maybe higher!

Create Launcher Script:

/Library/LaunchDaemons/limit.maxfiles.plist

Copy this entire code block and paste it into your terminal and push Return to create this file for you with correct permissions. It will (probably) ask for your password:

@janzenz
janzenz / disable.js
Last active July 6, 2016 19:24
Google Maps Zoom disable
var googleMaps = document.querySelectorAll(".google-maps-container");
for (var i = 0; i < googleMaps.length; i++) {
googleMaps[i].onclick = function(e) {
e.target.getElementsByTagName("iframe")[0].style["pointer-events"] = 'auto';
};
googleMaps[i].onmouseout = function(e) {
e.target.getElementsByTagName("iframe")[0].style["pointer-events"] = 'none';
}
}
@cobbman
cobbman / .htaccess (upload files from proxy)
Last active June 27, 2016 18:12
Checks for local files in wp-content/uploads and rewrites the URL to the live server if needed. Also checks that the HOST is local, so it won't run outside of your dev URL.
// Place this BEFORE the WordPress Rewrite rules
// Be sure to edit LOCALHOST and LIVESITE with the proper URL's
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp-content/uploads/
RewriteCond %{HTTP_HOST} ^LOCALHOST\.dev$ [NC]
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
@cobbman
cobbman / full-screen-me.js
Last active July 25, 2016 23:21
A jQuery snippet for making elements on your page full-screen. Update vars on line 8 & 9 to begin.
/*
* => FULL SCREEN
* => Author: William <hello@bigwilliam.com>
* ---------------------------------------------------------------------------*/
/*** Set these vars to the correct elements ***/
var fullScreenEl = '#fullScreenMe'; // This is the section/wrapper which should occupy the screen
var keepOnScreen = ['#keepOnScreen', '#wpadminbar', '.masthead']; // Siblings of FullScrenEl to keep on screen (i.e. header nav)
@salcode
salcode / .gitignore
Last active April 3, 2024 18:38
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert