Skip to content

Instantly share code, notes, and snippets.

View georgioupanayiotis's full-sized avatar
🛰️

Panayiotis Georgiou georgioupanayiotis

🛰️
View GitHub Profile
(function () {
var ns = document.createElement('noscript')
var iframe = document.createElement('iframe')
iframe.src = 'https://www.googletagmanager.com/ns.html?id=GTM-NDRZTBJD'
iframe.height = '0'
iframe.width = '0'
iframe.style.display = 'none'
iframe.style.visibility = 'hidden'
ns.appendChild(iframe)
document.body.insertBefore(ns, document.body.firstChild)
@georgioupanayiotis
georgioupanayiotis / custom-head.js
Created May 19, 2026 11:56
custom head examnple
// custom-head.js (the file NEXT_PUBLIC_CUSTOMJS_HEAD points to)
// --- Google Tag Manager ---
(function(w,d,s,l,i){
w[l]=w[l]||[];
w[l].push({'gtm.start': new Date().getTime(), event:'gtm.js'});
var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),
dl=l!='dataLayer'?'&l='+l:'';
j.async=true;
(function () {
var ns = document.createElement('noscript')
var iframe = document.createElement('iframe')
iframe.src = 'https://www.googletagmanager.com/ns.html?id=GTM-NDRZTBJD'
iframe.height = '0'
iframe.width = '0'
iframe.style.display = 'none'
iframe.style.visibility = 'hidden'
ns.appendChild(iframe)
document.body.insertBefore(ns, document.body.firstChild)
@georgioupanayiotis
georgioupanayiotis / gtm-init.js
Created May 19, 2026 09:23
gtm init example
(function (w, d, s, l, i) {
w[l] = w[l] || []
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : ''
j.async = true
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl
f.parentNode.insertBefore(j, f)
})(window, document, 'script', 'dataLayer', 'GTM-NDRZTBJD')
@georgioupanayiotis
georgioupanayiotis / base64-encoded-Authorization.js
Created January 16, 2023 21:46
Generating base64-encoded Authorization Node.js
var username = 'Test';
var password = '123';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
var header = {'Host': 'www.example.com', 'Authorization': auth};
var request = client.request('GET', '/', header);
<div id="membercounterwrapper"> <span>EDITION #</span>
<a href="#"><span class="odom">0</span></a>
</div>
@georgioupanayiotis
georgioupanayiotis / zendesk-tickets.js
Created October 31, 2017 15:42
Create multiple zendesk tickets
for(x=0; x<500; x++) {
var title = "Ticket #" + x;
var subject = "Test ticket #" + x;
var body = "This is test ticket #" + x;
$.ajax({
url: '/api/v2/tickets.json',
contentType:'application/json',
type: 'POST',
data: JSON.stringify({"ticket": {"subject": subject , "comment": { "body": body }}})
});
@georgioupanayiotis
georgioupanayiotis / complex-example.js
Created March 15, 2017 10:44
Complex object validatio
var objectSchema = Joi.object().keys({
username: Joi.string().alphanum().min(3).max(50).required(),
email: Joi.string().email().required()
});
@georgioupanayiotis
georgioupanayiotis / simple-example.js
Created March 15, 2017 10:41
Example - Simple Joi Schema
var stringSchema = Joi.string().min(3).max(30);
Joi.validate(‘valid string’, stringSchema,
function(error,val) {
//do stuff
});
@georgioupanayiotis
georgioupanayiotis / main.js
Created February 8, 2017 12:01
Node.js - Intro Hello World example
var http = require("http");
http.createServer(function (request, response) {
// Send the HTTP header
// HTTP Status: 200 : OK
// Content Type: text/plain
response.writeHead(200, {'Content-Type': 'text/plain'});
// Send the response body as "Hello World"