Skip to content

Instantly share code, notes, and snippets.

View calvez's full-sized avatar
🏠
Working from home

calvez calvez

🏠
Working from home
  • Budapest, Hungary
View GitHub Profile
<?php
add_filter('woocommerce_product_single_add_to_cart_text', 'rental_single_product_add_to_cart',10,2);
add_filter('woocommerce_product_add_to_cart_text', 'rental_single_product_add_to_cart',10,2);
function rental_single_product_add_to_cart( $title,$product ) {
return 'Ajánlatkérés';
}
add_action('woocommerce_widget_shopping_cart_before_buttons', 'rental_before_mini_cart_checkout',10);
function rental_before_mini_cart_checkout(){
@calvez
calvez / functions.php
Created July 24, 2018 09:23 — forked from furtive/functions.php
In WooCommerce, make the online store notice only show up in store pages as opposed to the entire site, which is the default behaviour.
if ( ! function_exists( 'woocommerce_demo_store' ) ) {
/**
* Adds a demo store banner to the site if enabled
*
* @access public
* @return void
*/
function woocommerce_demo_store() {
if ( get_option( 'woocommerce_demo_store' ) == 'no' )
@calvez
calvez / mogrify
Created July 8, 2018 20:00
imagemagicks
mogrify -resize 1500x1500 -format jpg -path ../ESG_small *.jpg
<?php
header('Content-Type: application/json');
//$xmlfile = 'xml/EIT_00002_20140507.xml';
function xml2json($file) {
if (file_exists($file)) {
$xml = simplexml_load_file($file);
$date = $xml->EventDate;
@calvez
calvez / slide-inner-content.html
Created June 4, 2018 10:03
target slide variations
<div class="carousel-inner" style="float: none; margin: 0 auto;">
<div class="row">
<div class="col-md-12">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
@calvez
calvez / wp-update.sh
Created May 17, 2018 04:39 — forked from bananana/wp-update.sh
Bash script to run automatic updates and backups using wp-cli
#!/bin/bash
#
# Backup and update WordPress using wp-cli
#
# Set the -e shell option so the script exits immediately if any command within
# it exits with a non-zero status.
set -e
# Set PATH environment variable
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
find . -iname '*.php' -mmin -$(echo $(date +%s) - $(date +%s -d"Apr 25, 2018 00:00:01") | bc -l | awk '{print $1 / 60}' ) -mmin +$(echo $(date +%s) - $(date +%s -d"May 3, 2018 23:59:59") | bc -l | awk '{print $1 / 60}' ) -exec ls -ld --time-style=full-iso {} \; > ~/getthisfucker/maybemodified.txt
// Found at:
// https://github.com/wp-cli/wp-cli/issues/1734#issuecomment-87897943
//
// Note that $_SERVER['DOCUMENT_ROOT'] will return a string with a trailing slash on
// some systems and not others, so we'll make sure it's gone in all cases where there
// is ambiguity by using rtrim.
// Also note that this is above the loading of the wp-config-*.php files so that these can
// be over-ridden as required.
<?php /* php tag is just for gist highlight*/
if (!empty($badusers)) {
foreach ($badusers as $bu) {
$output .= "PROBLEM with uid [<b>".$bu['userid']."</b>]: freemoney [<b>".n($bu['freemoney'])."</b>] should be [<b>".n($bu['calculated'])."</b>], diff is [<b>".n(abs($bu['freemoney']-$bu['calculated']))."</b>]<br/>\n";
if ($bu['calculated'] >= 0) {
if (!$sim) {
$conn->execute('update betusers set freemoney = '.$bu['calculated'].' where userid = '.$bu['userid']);
}
$output .= "Fixed with sql update.<br />\n";
} else {
$output .= "Negative value, not fixed, check manually!<br />\n";