Skip to content

Instantly share code, notes, and snippets.

@facelordgists
facelordgists / dms-skeleton-v2-changelog.md
Created March 26, 2015 19:50
DMS Skeleton V2 Changelog

Changelog

2.0.1 [03/25/2015]

  • P tags are now set to 16px for 0-767px breakpoint as per Google's recommendation.
  • Footer header sizes now take effect in 0-767px breakpoint instead of just 0-480px.
  • Fixed font size for code tags
  • Classes added for mobile alignment (0-767px):
    • m-align-right
  • m-align-left
@facelordgists
facelordgists / check-if-string-contains-string.md
Last active August 29, 2015 14:18
Kirby Toolkit stuff to use

Check if a string contains a string

http://getkirby.com/docs/toolkit/api/str/contains

//str::contains($str, $needle, $i = true);

$string = "This is a long string with a DooHicky inside";
$needle = "doohicky";
$doohicky_status = str::contains($string, $needle);
@facelordgists
facelordgists / wp-page-preview.php
Created April 16, 2015 19:09
Display a page preview with featured image and auto generated exerpt
<?php
// Add shortcode for displaying page with thumbnail and excerpt
function show_page($atts, $content = null) {
extract(shortcode_atts(array(
'id' => false,
), $atts));
// display error message if user is logged in
if($id == false) {
@facelordgists
facelordgists / reset-wp-pass.sql
Created May 12, 2015 19:44
Reset WordPress user password using SQL query
# https://www.siteground.com/kb/how_to_reset_my_wordpress_admin_password/
UPDATE `wp_users` SET `user_pass` = MD5('new_password_here') WHERE `wp_users`.`user_login` = "admin_username";
@facelordgists
facelordgists / plesk-mysql.sql
Last active August 29, 2015 14:22
MYSQL: Useful mysql queries for Plesk
-- Plesk domain structure
-- http://pleskhacker.com/all-tables/domains-all-tables/psa_domains/
-- Show domains
-- Output: name, id, status, and hosting type
mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "SELECT domains.name, domains.id, domains.status, domains.htype FROM domains"
-- Only show active domains that are not suspended or disabled domains
-- Output: name, hosting type
@facelordgists
facelordgists / get-current-script-dir.sh
Created July 15, 2015 22:58
Get the current folder a bash script is executed from
#!/bin/bash
#http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
$time_pre = microtime(true);
exec(...);
$time_post = microtime(true);
$exec_time = $time_post - $time_pre;
@facelordgists
facelordgists / reset-file-folder-permissions.sh
Created August 5, 2015 21:08
Reset file and folder permissions
find . -type d -print0 | xargs -0 chmod 755
find . -type f -print0 | xargs -0 chmod 644
@facelordgists
facelordgists / get-directory-via-sftp.sh
Last active August 29, 2015 14:28
SFTP using LFTP w/ fancy options
#!/bin/bash
# usage:
# sh get-directory-via-sftp.sh hostname:port username password source_folder destination_folder
# sh get-directory-via-sftp.sh example.com:2222 awesome_user Ultra-pw-9000 /remote-folder-name ~/Downloads/
# This will copy /remote-folder-name to ~/Downloads/remote-folder-name
HOST=$1
USER=$2
PASS=$3
@facelordgists
facelordgists / auto-dump-wp-db.sh
Created September 28, 2015 23:02
Auto dump WP database from commandline using wp-config
db_name=`grep "DB_NAME" wp-config.php | cut -d \' -f 4` && db_user=`grep "DB_USER" wp-config.php | cut -d \' -f 4` && db_pw=`grep "DB_PASSWORD" wp-config.php | cut -d \' -f 4` && mysqldump -u$db_user -p$db_pw $db_name > $db_name.sql