Skip to content

Instantly share code, notes, and snippets.

Dainius dainiuxt

Block or report user

Report or block dainiuxt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slice-splice-arrays.js
/* Free c code camp task
Are there any flaws in my solution (code passes test as OK)?
You are given two arrays and an index.
Use the array methods slice and splice to copy each element of the first array into the second array, in order.
Begin inserting elements at index n of the second array.
Return the resulting array. The input arrays should remain the same after the function runs.
function frankenSplice(arr1, arr2, n) {
View gist:f6680dd662548f4f15ddee85cd9e70b7
sudo smartctl --all /dev/sda
smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.10.0-28-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke,
Model Family: Toshiba 2.5" HDD MK..76GSX
Device Model: TOSHIBA MK6476GSX
Serial Number: 22DDPAMST
LU WWN Device Id: 5 000039 3d2786cc0
Firmware Version: GS001C
dainiuxt /
Last active Dec 8, 2017
How to Work with the 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 / functions.php
Created Mar 24, 2017
Add custom code before post content via functions.php
View functions.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 / style.css
Created Mar 23, 2017
Divi portfolio grid view image resize. Just change the padding-top until you get the desired aspect ratio.
View style.css
.et_portfolio_image {
padding-top: 100%;
.et_portfolio_image img {
position: absolute;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
dainiuxt / index.html
Created Mar 22, 2017
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…
View index.html
<div class="original-image">
<p>original image</p>
<img src="">
<div class="image">
<p>object-fit: fill</p>
<img class="object-fit_fill" src="">
dainiuxt / divi_contactform_submit_button.js
Last active Mar 22, 2017
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
View divi_contactform_submit_button.js
<script type="text/javascript">
jQuery("button.et_pb_contact_submit").text('<strong>This is it</strong>');
dainiuxt / gist:731ffebc9672a600022a
Last active Mar 24, 2017
Install packages in R on demand (if require)
View gist:731ffebc9672a600022a
if (!require("data.table")) {
if (!require("reshape2")) {
View R trouble.r
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)
ggplot(monthly[monthly$Well_N == "NSD1",],aes(Date_m)) +
You can’t perform that action at this time.