Skip to content

Instantly share code, notes, and snippets.

@ridinghoodmedia
ridinghoodmedia / style.css
Created July 31, 2018 16:26
Default stylesheet
/* Prevent ios auto zooming select */
@media (max-width: 767px) {
select {
font-size: 16px;
}
select:focus {
font-size: 16px;
}
https://stackoverflow.com/questions/1125968/how-do-i-force-git-pull-to-overwrite-local-files
git fetch --all
Then, you have two options:
git reset --hard origin/master
OR If you are on some other branch:
git reset --hard origin/<branch_name>
@ridinghoodmedia
ridinghoodmedia / Microsoft Office 2016 Mac not recognizing license keys
Created July 9, 2018 20:53
Fix for Microsoft Office 2016 Mac not recognizing license keys
MS office not recognizing keys:
https://answers.microsoft.com/en-us/msoffice/forum/all/office-2016-for-mac-unable-to-activate/5070ddce-cb74-4c7c-9acf-a5dc2a6d2d84?auth=1
1. go to ~/Library/Group Containers/
2. Delete all files starting with “UBF”
3. Restart computer
@ridinghoodmedia
ridinghoodmedia / wp_snippets.php
Last active February 3, 2018 02:33
Wordpress snippets
// Hide error display
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
add_filter( 'auto_update_plugin', '__return_true' );
This filter tells WordPress automatic updater to automatically install plugin updates when they’re available.
If you also want to automatically update your themes, then you can add another code like this:
1 add_filter( 'auto_update_theme', '__return_true' );
@ridinghoodmedia
ridinghoodmedia / postgres-cheatsheet.md
Last active December 7, 2017 05:51 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@ridinghoodmedia
ridinghoodmedia / jquery.snippets.js
Created February 24, 2017 15:39
Helpful code snippets
// If variable exists
if ( typeof pagetype !== 'undefined' && pagetype == 'textpage' ) {
...
}
@ridinghoodmedia
ridinghoodmedia / ajax-tools.js
Last active June 15, 2016 00:59
Useful ajax snippets
// Since the settings object is tied to that ajax call, you can simply add in the indexer
// as a custom setting, which you can then access using this in the success callback:
// http://stackoverflow.com/questions/18413969/pass-variable-to-function-in-jquery-ajax-success-callback
//preloader for images on gallery pages
window.onload = function() {
var urls = ["./img/party/","./img/wedding/","./img/wedding/tree/"];
setTimeout(function() {
for ( var i = 0; i < urls.length; i++ ) {
$.ajax({
@ridinghoodmedia
ridinghoodmedia / array-tools.php
Last active June 15, 2016 17:42
PHP array functions
<?php
// Use array_search to get the key and remove it with unset if found:
if (($key = array_search('strawberry', $array)) !== false) {
unset($array[$key]);
}
// array_search returns false (null until PHP 4.2.0) if no item has been found.
// And if there can be multiple items with the same value, you can use array_keys to get the keys to all items:
foreach (array_keys($array, 'strawberry') as $key) {
@ridinghoodmedia
ridinghoodmedia / envira-escape.php
Last active May 10, 2016 03:45
Escape envira gallery output
// Essentially this, but need to escape the output, as images are taken from ACF pro fields
function rl_gallery() {
envira_gallery( 'gallery', 'slug' );
}
// Escape and echo gallery
echo wp_kses( rl_gallery(), array(
'div' => array(
'class' => array(),
'class' => array(),
//Useful js snippets
//Redirect to refferer url
if (document.referrer != "") {
location.href = document.referrer;
}