Skip to content

Instantly share code, notes, and snippets.

@hayatbiralem
hayatbiralem / gist:eb25df49899cd1f97616ce72253724e0
Created July 14, 2021 09:07
Parse published (public) Google Spreadsheet HTML data into Javascript array
// Thanks to this gist: [Sample HTML/JS to parse a Google Spreadsheet](https://gist.github.com/terrywbrady/a03b25fe42959b304b1e)
var htmlEndPoint = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vREXBtuL2uKofq9ufXsIlytbONUR0-q_tf1Ucm14JpeE5KAdry97CCwvivf3e5NkCAnZ1Xg4qYa0RCo/pubhtml';
(function($){
var parseHtmlTableToJson = function($table){
var data = [];
var $headers = $("tr:first-child td", $table);
var headers = [];
let botToken='1356037801:AAG8tzLp03DIhпр48jZ-MHC3NNGOF6QFjM4'//токен бота
let webAppUrl='https://script.google.com/macros/s/AKfycbxK945bZlFW_8rrtPt0XmkVyN7ra0ELuUZHyOeR9zvOPcDxUGxu/exec'//id таблицы
let telegramUrl = "https://api.telegram.org/bot" + botToken;
function setWebhook(){
var url = telegramUrl + "/setWebhook?url=" + webAppUrl;
var response = UrlFetchApp.fetch(url);
Logger.log(response)
}
function deleteWebhook(){
@marklchaves
marklchaves / popup-maker-send-impression-conversion-to-ga4-all-popups.js
Last active November 17, 2021 14:07
Popup Maker: Send a popup impression and conversion to GA4 using the gtag.js API
/**
* Generic version to send impresions for all popups.
* I.e., no harcoded values.
*/
jQuery(document).ready(function($){
// Let's send popup impressions to GA4.
$("[id^='pum-']").on("pumAfterOpen", function (e) {
console.log(`[GA4] Popup impression for popup ${$(e.target).attr("id")}.`);
gtag("event", "popup_impression", {
popup_id: $(e.target).data("popmake").slug,
@wordpressvn
wordpressvn / minifier.php
Created July 2, 2021 10:11 — forked from abranhe/minifier.php
WordPress Minifier
<?php
/**
* W3C Fix and HTML minifier
* Nobody knows how this work, so don't touch it!!!
*
* https://wordpress.stackexchange.com/a/227896/129134
* https://stackoverflow.com/a/41148695
*/
@nufeng1999
nufeng1999 / Win11_taskbar_chg2_Win10_taskbar.md
Last active May 19, 2024 06:27
[Windows 11 taskbar change to Windows 10 taskbar] #Windows 11 #Windows 10 #taskbar

Win11_taskbar_chg2_Win10_taskbar.reg

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]

"Start_ShowClassicMode"=dword:00000001

@crazyyy
crazyyy / _readme.md
Last active September 21, 2024 21:03
#wordpress #php || Snipets

Other Snippets

If / Else load Pages

  if ( is_front_page() && is_home() ){
      // Default homepage
  } elseif ( is_front_page()){
      //Static homepage
  } elseif ( is_home()){
@marklchaves
marklchaves / send-generate-lead-ga4-using-gtag.js
Last active October 8, 2022 07:19
jQuery for sending a generate_lead event (form submission) to GA4 using WPForms and gtag.js API
/** We'll use WPForms as an example. */
jQuery(document).ready(function($){
// Trick from https://www.chrisains.com/seo/tracking-wpforms-submissions-with-google-analytics/
let $wpConfirmationDiv = $('#wpforms-confirmation-357');
if ($wpConfirmationDiv.length) {
console.log('[GA4] WPForms #357 was successfully submitted.');
gtag("event", "generate_lead", {
'form_id': 'WPForm #357', // TO DO: Try to get form ID or name here.
});
}
###
# Powershell can't SFTP by itself, so it's necessary to install a client on Windows to use it as a bridge.
# In my case, I decided to install WinSCP (I think it's a good option):
# * https://stackoverflow.com/questions/38732025/upload-file-to-sftp-using-powershell/38735275#38735275
# * https://winscp.net/eng/download.php
# Here are some links about how Get-ChildItem works so you can get and filter the files that you need:
# * https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-7.1
# * https://www.pdq.com/blog/using-get-childitem-find-files/
###
@marklchaves
marklchaves / send-form-impression-ga4-using-gtag.js
Last active November 17, 2021 14:43
Send a form impression event to GA4 using gtag.js API.
(function() {
if (typeof gtag === 'undefined') {
console.log('[GA4] gtag is undefined.');
return;
}
const formElts = document.querySelectorAll('form');
let formName = '(not set)';
// If no forms, bail.
if (formElts.length === 0) return;
[...formElts].map((f) => {
@amboutwe
amboutwe / yoast_seo_breadcrumb_remove_static_blog_page_only.php
Created May 12, 2021 22:46
Remove Yoast breadcrumb from static blog page
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast breadcrumb from static blog page
* Credit: Yoast team
* Last Tested: May 12, 2021 using Yoast SEO 16.2 on WordPress 5.7.1
*/
add_filter( 'wpseo_schema_webpage', 'remove_breadcrumb_schema_ref', 10, 1);
function remove_breadcrumb_schema_ref( $piece ){