Author: scalialaw
Remove Java on your Mac
java -version
If you see 1.6 or 1.7 in the response, go to /System/Library/Java/JavaVirtualMachines/ directory and delete it.
Alternatively, use the command line:
sudo rm -rf /System/Library/Java/JavaVirtualMachines/
Learn more: “How to disable Java on your Mac“
Roll Your Own Social Media Buttons
I recently tested out several WordPress’s social media share plug-ins and disappointed with unnecessary injections of JavaScripts and CSS. Some services even use their own site as a gateway to server up the social media services. I was frustrated and ended up rolling my own, thanks to this blog post. Here’s my customized codes:
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&t=<?php the_title(); ?>" target="_blank"><img src="facebook.png" alt="Share on Facebook"></a>
<a href=”https://plusone.google.com/_/+1/confirm?hl=en-US&url=<?php the_permalink() ?>” target=”_blank”><img src=”google-plus.png” alt=”Share on Google+”></a>
<a href=”http://twitter.com/share?text=<?php the_title(); ?> -&url=<?php the_permalink() ?>” target=”_blank”><img src=”twitter.png” alt=”Share on Twitter”></a>
<a href=”http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink() ?>” target=”_blank”><img src=”linkedin.png” alt=”Share on LinkedIn”></a>
Sass
$ sass --watch style.scss:style.css --style compressed
// Import
@import "normalize";
// Variables
$body_font: 'Georgia', serif;
// Mixin
@mixin rounded_corners($rounding) {
-webkit-border-radius:$rounding;
-moz-border-radius: $rounding;
-o-border-radius: $rounding;
border-radius: $rounding; }
MySQL: Repair & Optimize all Tables in all Databases
mysqlcheck -u root -p --auto-repair --check --optimize --all-databases
or
mysqlcheck -Aor -u root -p
A = all databases
o = optimize
r = repair
via Byte Mods
Apache Rewrites
Redirect non-www to www with .htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Example: law.gmu.edu to www.law.gmu.edu
Add trailing slash (/) to URL:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.sample.com/$1/ [QSA,L,R=301]
Example: law.gmu.edu to law.gmu.edu/
Forgot Manager Login Upgrade and Disabled
Security note from MODX: The Forgot Manager Login plugin distributed with all versions of MODX Evolution (and 0.9.x) contains a vulnerability that allows users to gain unauthorized access to the MODX Manager.
Action:
Upgrade Forgot Manager Login to version 1.1.4 and also disabled the plug in.
Change Linux Timezone
MODX Evo: Turn Off System Events Tracking
document.parser.class.inc.php (manager/includes)
@ ini_set("track_errors", "0");
(0=off, 1=on)
Upgrade Notes
WordPress: Just hit the upgrade button
MODX: 1.06
- Follow Upgrading Guide (Alternate Method).
- Back up config.inc.php and document.parser.class.inc.php
- Once upgraded, change default sort order in resource tree:
if (!isset($_SESSION['tree_sortby']) && !isset($_SESSION['tree_sortdir'])) {
// This is the first startup, set default sort order
$_SESSION['tree_sortby'] = 'menuindex'; // Change menuindex to a value of your choice.
$_SESSION['tree_sortdir'] = 'ASC';
} - PHx Bug & pageTOC issue: The fix is to increase the pcre.backtrack_limit setting in php.inifrom 100000 to 800000
[Pcre]
;PCRE library backtracking limit.
pcre.backtrack_limit=800000
Modifying the document.parser.class.inc.php
Add the following codes when upgrade:
// START CODE BY PAUL BOHMAN/DONNY TRUONG
// Ability to get all documents, whether deleted or unpublished, added by Paul Bohman
if ($published == '*') $sqlPublished = '';
else $sqlPublished = "AND sc.published=$published";
if ($deleted == '*') $sqlDeleted = '';
else $sqlDeleted = "AND sc.deleted=$deleted";
// END CODE BY PAUL BOHMAN/DONNY TRUONG
And here:
$result= $this->getTemplateVars($vars, "*", $docid, $published, "", "", $sep, $deleted=0);
// The deleted option above was added by Paul Bohman/Donny Truong
Remember to add the codes for CASifying MODX as well.