Skip to content

Instantly share code, notes, and snippets.

View agronom81's full-sized avatar

Pavlo Petrenko agronom81

  • WebDesignSun
  • Ukraine, Mykolaiv
View GitHub Profile
@agronom81
agronom81 / gist:503841607193a2eda4ee
Created May 10, 2015 11:38
maximum z-index on the page
var highest_index = 0,
elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length - 1; i++) {
if (parseInt(elements[i].style.zIndex) > highest_index) {
highest_index = parseInt(elements[i].style.zIndex);
};
};
var zIndex = highest_index + 10;
@agronom81
agronom81 / gist:b63d8077ed89e501c3f3
Last active January 27, 2016 10:00
get the_content with ID
// Setting the Post ID in a variable for which the content is required
$the_postid = 20;
$the_post_content = get_post($the_postid);
$content = $the_post_content->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
// Print Content data or further use it as required
echo $content;
function mailTo ( $emails, $subject, $message ) {
$mail = new PHPMailer;
$mail->isSMTP();
$mail->isHTML(true);
$mail->setFrom( SITE_EMAIL, SITE_NAME );
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = SMTP_LOGIN;
$mail->Password = SMTP_PASS;
@agronom81
agronom81 / Change the Add to Cart text
Last active July 5, 2018 11:18
Change the Add to Cart text in WooCommerce
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
function custom_woocommerce_product_add_to_cart_text() {
global $product;
$product_type = $product->get_type();
switch ( $product_type ) {
case 'external':
return __( 'Take me to their site!', 'woocommerce' );
break;
window.history.replaceState({}, document.title, "?variant=" + variant.id);
@agronom81
agronom81 / gist:7d071e9f0a6e7bfdc7c63f646d363513
Last active January 4, 2019 05:49
Briteverify with public API KEY
var mail = $('input[type=email]').val();
//username is public API Key
var url = "https://bpi.briteverify.com/emails.json?address="+mail+"&username=772454564564564564564563";
$.ajax({
url: url,
dataType: "jsonp",
success: function(data){
var status = data.status;
$('input[type=email]').addClass(status);
if(status === 'valid') {
@agronom81
agronom81 / create and load csv
Created January 24, 2019 07:31
create and load csv
/**
* load csv
*/
add_action("init", "download_csv");
function download_csv() {
if (isset($_POST['download_csv'])) {
function outputCsv( $fileName, $assocDataArray ) {
@agronom81
agronom81 / mysqldump.php
Created March 6, 2020 11:41 — forked from micc83/mysqldump.php
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
@agronom81
agronom81 / firebase.js
Created February 18, 2021 20:47
Fiebase.js
import firebase from "firebase/app";
import "firebase/analytics";
import "firebase/messaging";
import axios from "axios";
let firebaseInit = {
methods: {
firebaseInit: function () {
const firebaseConfig = {
apiKey: "AIzaSyAZW895vVsq-sGPPRm52fQI3V3j6yvylRc",
importScripts("https://www.gstatic.com/firebasejs/8.2.6/firebase-app.js");
importScripts("https://www.gstatic.com/firebasejs/8.2.6/firebase-messaging.js");
try {
firebase.initializeApp({
apiKey: "AIzaSyAZW895vVsq-sGPPRm52fQI3V3j6yvylRc",
authDomain: "push-project-e1ffa.firebaseapp.com",
projectId: "push-project-e1ffa",
storageBucket: "push-project-e1ffa.appspot.com",
messagingSenderId: "237926722474",