Skip to content

Instantly share code, notes, and snippets.

View franzenzenhofer's full-sized avatar

Franz Enzenhofer franzenzenhofer

  • http://www.fullstackoptimization.com/
  • Vienna, Austria
View GitHub Profile
@franzenzenhofer
franzenzenhofer / Google-Apps-Script-Monthly-Traffic-Analysis
Created May 23, 2023 21:25
This Google Apps Script is designed to analyze and visualize web traffic data from Google Sheets. It generates a line chart that displays the total and median clicks for each month, discarding any incomplete months. The chart also includes a trendline to help identify patterns or trends over time. This script is especially useful for SEO analyst…
function createChart() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Get the last row with content
var lastRow = sheet.getLastRow();
// Get data range
var dataRange = sheet.getRange('A2:B' + lastRow);
var data = dataRange.getValues();
@franzenzenhofer
franzenzenhofer / hl-en-bookmarklet
Created March 14, 2019 12:22
change any google page to english language
let l = window.location;
const p = new URLSearchParams(l.search);
p.set('hl','en');
window.location.search="?"+p.toString();
//minified bookmarklet code
//javascript:let l=window.location,p=new URLSearchParams(l.search);p.set("hl","en");window.location.search="?"+p.toString();
@franzenzenhofer
franzenzenhofer / seo.user.js
Created September 5, 2012 08:02
greasmonkey / chrome - userscript -shows important SEO head information
// ==UserScript==
// @name shows important SEO head information
// @namespace http://www.facesaerch.com/
// @description show canonical, noindex, nofollow
// @include *
// ==/UserScript==
function trim12 (str) {
var str = str.replace(/^\s\s*/, ''),
ws = /\s/,
@franzenzenhofer
franzenzenhofer / gist:1881270
Created February 22, 2012 04:10 — forked from endtwist/gist:1630834
Paste event in Google Chrome
$( 'body' ).bind( 'paste', function( evt ) {
var items = evt.originalEvent.clipboardData.items
, paste;
// Items have a "kind" (string, file) and a MIME type
console.log( 'First item "kind":', items[0].kind );
console.log( 'First item MIME type:', items[0].type );
// If a user pastes image data, there are 2 items: the file name (at index 0) and the file (at index 1)
// but if the user pastes plain text or HTML, index 0 is the data with markup and index 1 is the plain, unadorned text.
@endtwist
endtwist / gist:1630921
Created January 18, 2012 04:17
Paste event in Safari
// Safe to say...textarea is a good idea: <textarea id="pasteField"></textarea>
$( '#pasteField' ).on( 'paste', function( evt ) {
// Safari has a weird "types" list that we need to loop through and no "items" array.
var i = 0, items = [], item, key = 'text/plain', kind = 'string';
while (i < evt.originalEvent.clipboardData.types.length) {
var key = evt.originalEvent.clipboardData.types[i];
if( !key.match( /(text\/)|(plain-text)/i ) ) {
kind = 'file';
}
@endtwist
endtwist / gist:1630899
Created January 18, 2012 04:12
Paste event in Internet Explorer
// We need a textarea for IE, too: <textarea id="pasteField"></textarea>
$( '#pasteField' ).bind( 'paste', function( evt ) {
// In true Microsoft form, the type to get plain text is Text with a captial T.
console.log( window.clipboardData.getData( 'Text' ) );
} );
@endtwist
endtwist / firefox_paste.html
Created January 18, 2012 04:04
Paste event in Firefox
<textarea id="pasteField"></textarea>
@endtwist
endtwist / gist:1630834
Created January 18, 2012 03:57
Paste event in Google Chrome
$( 'body' ).bind( 'paste', function( evt ) {
var items = evt.originalEvent.clipboardData.items
, paste;
// Items have a "kind" (string, file) and a MIME type
console.log( 'First item "kind":', items[0].kind );
console.log( 'First item MIME type:', items[0].type );
// If a user pastes image data, there are 2 items: the file name (at index 0) and the file (at index 1)
// but if the user pastes plain text or HTML, index 0 is the data with markup and index 1 is the plain, unadorned text.
@kaimallea
kaimallea / bitly.js
Created October 5, 2010 06:32
JSONP implementation of the bit.ly API for dynamic URL shortening
/**
* JSONP implementation of the bit.ly API for dynamic
* URL shortening
*
* @author = "Kai Mallea (kmallea@gmail.com)"
*
* TODO: Add domain param to choose between bit.ly and j.mp
*/