Skip to content

Instantly share code, notes, and snippets.

@dainiuxt
dainiuxt / wpSQL.md
Last active December 8, 2017 07:58
How to Work with the WordPress Database: 11+ Useful SQL Queries

https://www.wpkube.com/work-wordpress-database-11-useful-sql-queries/

  1. Change Your WordPress Password

Forgotten your password and locked yourself out of your WordPress site? No worries – you can reset it manually in the database with this SQL query:

UPDATE wp_users SET user_pass = MD5( '[new_password]' ) WHERE user_login = '[username]';

MD5 encrypts the new password so anyone gaining access to the database is not able to read the password.

@dainiuxt
dainiuxt / gist:731ffebc9672a600022a
Last active March 24, 2017 10:38
Install packages in R on demand (if require)
if (!require("data.table")) {
install.packages("data.table")
}
if (!require("reshape2")) {
install.packages("reshape2")
}
require("data.table")
require("reshape2")
@dainiuxt
dainiuxt / R trouble.r
Last active March 24, 2017 10:37
R trouble
Problem solved. Faulty code in line 16: geom_line(aes(y = monthly$CumOil, colour = "CumOil, 1000 m3"))
R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
Code:
library("ggplot2")
ggplot(monthly[monthly$Well_N == "NSD1",],aes(Date_m)) +
@dainiuxt
dainiuxt / functions.php
Created March 24, 2017 09:36
Add custom code before post content via functions.php
<?php
function my_before($content) {
if (is_single()) {
$beforecontent = previous_post_link(); ?> | <?php next_post_link();
$content = $beforecontent . $content;
return $content;
}
return $content;
}
add_filter('the_content', 'my_before');
@dainiuxt
dainiuxt / style.css
Created March 23, 2017 14:34
Divi portfolio grid view image resize. Just change the padding-top until you get the desired aspect ratio.
.et_portfolio_image {
padding-top: 100%;
}
.et_portfolio_image img {
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
@dainiuxt
dainiuxt / index.html
Created March 22, 2017 15:24
The object-fit property defines how an element responds to the height and width of its content box. It's intended for images, videos and other embeddable media formats in conjunction with the object-position property. Used by itself, object-fit lets us crop an inline image by giving us fine-grained control over how it squishes and stretches insi…
<div class="original-image">
<p>original image</p>
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/image.png">
</div>
<div class="image">
<p>object-fit: fill</p>
<img class="object-fit_fill" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/14179/image.png">
</div>
@dainiuxt
dainiuxt / divi_contactform_submit_button.js
Last active March 22, 2017 14:51
Submit Button Text in contact module can be changed by applying some JavaScript, just follow given steps to achieve the goal. Go to Divi > Theme Option > Integration Paste the given code in Head section
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("button.et_pb_contact_submit").text('<strong>This is it</strong>');
});
</script>