Skip to content

Instantly share code, notes, and snippets.

View wykydtronik's full-sized avatar
🎯
Focusing on Kafka

TЯON|K wykydtronik

🎯
Focusing on Kafka
View GitHub Profile
@wykydtronik
wykydtronik / cli
Last active March 16, 2018 23:28
pg_restore example windows
pg_restore.exe --host "awsrds.c8klwajefe444.us-west-2.rds.amazonaws.com" --port "5432" --username "username" -n public --dbname "exampledb" --exit-on-error --verbose --no-acl --no-owner "C:\\sqldump\\largedatabase.backup"
@wykydtronik
wykydtronik / gist:f3616ee4f6cf7d9b6e91b73f826fe1e3
Created April 15, 2017 05:11
how to echo custom author meta onto page
the_author_meta('jobtitle', $authorID);
get_the_author_meta('teampage', $authorID);
@wykydtronik
wykydtronik / gist:c3213ede9e1eb56c7daf924719d2c886
Created April 15, 2017 05:10
How To Remove Default personal_options in User Profiles
// Remove Default personal_options
add_filter('user_contactmethods','hide_profile_fields',10,1);
function hide_profile_fields( $contactmethods ) {
unset($contactmethods['aim']);
unset($contactmethods['jabber']);
unset($contactmethods['yim']);
return $contactmethods;
}
@wykydtronik
wykydtronik / gist:371b19c759e990e82eba306c47ad4626
Last active April 15, 2017 05:12
Adding A Drop Down Menu To personal_options
<?php // Personal Options
add_action( 'personal_options_update', 'save_custom_profile_fields' );
add_action( 'edit_user_profile_update', 'save_custom_profile_fields' );
function save_custom_profile_fields( $user_id ) {
update_user_meta( $user_id, 'teampage', $_POST['teampage'], get_user_meta( $user_id, 'teampage', true ) );
}
add_action( 'personal_options', 'add_profile_options');
function add_profile_options( $profileuser ) {
@wykydtronik
wykydtronik / gist:d1395aa4aa37c8a74be729ea3b4a0a1b
Created April 15, 2017 05:09
Adding Additional Profile Fields To WordPress Users
<?php // Personal Options
add_action( 'personal_options_update', 'save_custom_profile_fields' );
add_action( 'edit_user_profile_update', 'save_custom_profile_fields' );
function save_custom_profile_fields( $user_id ) {
update_user_meta( $user_id, 'phone_number', $_POST['phone_number'], get_user_meta( $user_id, 'phone_number', true ) );
update_user_meta( $user_id, 'greeting', $_POST['greeting'], get_user_meta( $user_id, 'greeting', true ) );
}
add_filter( 'user_contactmethods', 'add_contact_option', 10, 2 );
function add_contact_option( $user_contactmethods, $user ) {
<?php
$to = "test@email.com";
$header = "From: {$to}";
$subject = "Test Subject Here";
$body = "Hi this is a test email to see if the mail() function is working properly on your site.";
if (mail($to, $subject, $body, $header)) {
echo ("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
@wykydtronik
wykydtronik / gist:8c9e3b701ac138b19a7d012a34d34c6c
Created April 10, 2017 22:34
httpd-vhosts.conf example for macos sierra
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
ServerSignature Off
Options Indexes FollowSymLinks IncludesNoExec
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/localhost-error_log"
/**
* bodymargin.js
*
* Dynamic margin-top for body element.
*/
if (typeof jQuery === 'undefined') {
throw new Error('Flation Theme\' requires jQuery')
}
SELECT CONCAT( 'DROP TABLE `', TABLE_NAME, '`;' ) AS query
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE '%_gmp_%'
# revisions genocide
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( b.term_taxonomy_id = d.term_taxonomy_id)
WHERE a.post_type = 'revision'
AND d.taxonomy != 'link_category';