Skip to content

Instantly share code, notes, and snippets.

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

0xGorkamu gorkamu

🏠
Working from home
  • Zaragoza
View GitHub Profile
@gorkamu
gorkamu / custom_fb_event.php
Created November 14, 2021 08:54
Custom FB Event
<?php
if(is_product()) {
global $product;
$price = round((float)$product->get_price(),2);
$category = '';
foreach(get_the_terms( $id, 'product_cat' ) as $term) {
$category = $term->name;
}
<?
add_action( 'wp', 'woo_get_variations_attributes' );
function woo_get_variations_attributes()
{
if(is_product()) {
global $product;
$product_obj = get_page_by_path($product, OBJECT, 'product');
$product_id = $product_obj->ID;
$product = new Woo_WC_Product_Variable($product_id);
@gorkamu
gorkamu / Woo_WC_Product_Variable.php
Created October 9, 2018 17:42
Extended Woocommerce Variation Class
<?php
class Woo_WC_Product_Variable extends WC_Product_Variable {
public function get_all_variations() {
$available_variations = array();
foreach($this->get_children() as $child_id){
$variation = wc_get_product($child_id);
$available_variations[] = $this->get_available_variation($variation);
}
@gorkamu
gorkamu / functions.php
Created October 9, 2018 17:01
Woocommerce variation override
<?php
add_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
if(!function_exists('woocommerce_single_variation')) {
function woocommerce_single_variation() {
echo '<div class="woocommerce-variation single_variation woo_single_variation"></div>';
}
}
@gorkamu
gorkamu / test.js
Last active April 7, 2019 18:25
test
jQuery(document).ready(function(){
console.log("Start");
if(jQuery("table.variations").length){
if(jQuery("table.variations tr td.value div:nth-child(2) span:nth-child(1)").length > 0) {
setTimeout(function(){
eval(jQuery(".tawcvs-swatches").find("span").first().trigger("click"));
}, 1500);
}
@gorkamu
gorkamu / dash-send-tweet-endpoint.php
Created October 21, 2017 11:00
PHP middleware dash button
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$ua = $_SERVER['HTTP_USER_AGENT'];
//User agent must be set to "**MY-SECRET-USER-AGENT**" and the ?secret must be "key"
if("**MY-SECRET-USER-AGENT**" == $ua && isset($_GET['secret']) && "key" == $_GET['secret']){
@gorkamu
gorkamu / amazon-dash-watcher.sh
Created October 21, 2017 10:47
Amazon Dash Button Shell Script
#!/bin/sh
# The mac address of your Dash. Like: 74:75:48:b9:80:fb
MACADDR=
# Number of seconds to wait in between checks
INTERVAL=3
# Number of seconds to sleep after the button is pressed
WAITFOR=60
@gorkamu
gorkamu / Dockerfile
Created September 16, 2017 14:42
Fichero Dockerfile para el ejemplo de uso de Docker con Nodejs
FROM node:argon
# Creando el directorio de la aplicación
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Instalando todas sus dependencias
COPY package.json /usr/src/app/
RUN npm install
@gorkamu
gorkamu / server.js
Last active September 16, 2017 14:36
Fichero server.js para el ejemplo de uso de Docker con Nodejs
'use strict';
const express = require('express');
// Constantes
const PORT = 8080;
const HOST = '0.0.0.0';
// App
const app = express();
@gorkamu
gorkamu / package.json
Last active September 16, 2017 14:34
Fichero package.json para el ejemplo de uso de Docker con Nodejs
{
"name": "app_nodejs_con_docker",
"version": "1.0.0",
"description": "Ejemplo de uso de Docker con Nodejs",
"author": "Gorkamu el puto amo <gorkamu@elputoamo.com>",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {