This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##From PHP 5.6 => PHP 7.1 | |
Default PHP 5.6 is set on your system and you need to switch to PHP 7.1. Run the following commands to switch for Apache and command line. | |
#Apache:- | |
$ sudo a2dismod php5.6 | |
$ sudo a2enmod php7.1 | |
$ sudo service apache2 restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules | |
#First check uname -a to check your current version. | |
#List Unused Linux Kernel Headers, Images and Modules | |
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | |
sudo apt-get -y purge some-kernel-package | |
#List Unused Linux Kernel Headers, Images and Modules & Remove | |
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Source URL: https://www.sitepoint.com/web-foundations/mime-types-complete-list/ | |
$mime_types = array ( | |
'3dm' => 'x-world/x-3dmf', | |
'3dmf' => 'x-world/x-3dmf', | |
'a' => 'application/octet-stream', | |
'aab' => 'application/x-authorware-bin', | |
'aam' => 'application/x-authorware-map', | |
'aas' => 'application/x-authorware-seg', | |
'abc' => 'text/vnd.abc', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var us_states_lat_lng = [ | |
{lat: 32.806671, lng: -86.791130}, | |
{lat: 61.370716, lng: -152.404419}, | |
{lat: 33.729759, lng: -111.431221}, | |
{lat: 34.969704, lng: -92.373123}, | |
{lat: 36.116203, lng: -119.681564}, | |
{lat: 39.059811, lng: -105.311104}, | |
{lat: 41.597782, lng: -72.755371}, | |
{lat: 39.318523, lng: -75.507141}, | |
{lat: 38.897438, lng: -77.026817}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$us_states = array( | |
'AL' => 'Alabama', | |
'AK' => 'Alaska', | |
'AZ' => 'Arizona', | |
'AR' => 'Arkansas', | |
'CA' => 'California', | |
'CO' => 'Colorado', | |
'CT' => 'Connecticut', | |
'DE' => 'Delaware', | |
'DC' => 'District of Columbia', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Print WordPress Taxonomy Terms as list | |
* @param [type] $terms_array [description] | |
* @param [type] $first_item [description] | |
* @return [type] [description] | |
*/ | |
function print_terms($terms_array, &$first_item) { | |
if(!$terms_array || count($terms_array) < 1) return; | |
foreach($terms_array as $term) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get posts year | |
* @return [type] [description] | |
*/ | |
function get_post_years() { | |
global $wpdb; | |
$sql = "SELECT YEAR(STR_TO_DATE(p.post_date, '%Y')) as year | |
FROM $wpdb->posts as p | |
WHERE p.post_type = 'post' AND p.post_status = 'publish' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Save this snippet in Packages/User/wpbaseurl.sublime-snippet --> | |
<snippet> | |
<content><![CDATA[ | |
define('WP_HOME', 'http://${1}.mh/'); | |
define('WP_SITEURL', 'http://${1}.mh/'); | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>wpbaseurl</tabTrigger> | |
<description>WordPress Base URL</description> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make a file named virtualhost and place it in /usr/local/bin folder. | |
# Give +x permission to the file. | |
# use as | |
# virtualhost sitename.tld relative_path_to/var/www/ | |
# i.e virtualhost d7.san d7 | |
#!/bin/bash | |
### Set default parameters | |
action='create' | |
domain=$1 |