Skip to content

Instantly share code, notes, and snippets.

Kostas Minaidis kostasx

Block or report user

Report or block kostasx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kostasx
kostasx / gist:f1d65ced9602b2ca6992bf71257974d9
Created May 5, 2019
DOM Manipulation Performance in JavaScript
View gist:f1d65ced9602b2ca6992bf71257974d9
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
@kostasx
kostasx / Git.md
Created May 5, 2019 — forked from dirkdunn/Git.md
Git lesson
View Git.md

Git Fundamentals

LEARNING OBJECTIVES

After this lesson, you will be able to:

  • Explain what version control is
  • Explain why developers use version control
  • Explain the process of how git works
  • Distinguish between local and remote repositories
  • Understand basic git commands like init, add, commit, push, pull and clone
@kostasx
kostasx / eventloop-afdemp-4-2-class-exercise-11.markdown
Created Mar 1, 2019
EventLoop | AfDEMP 4.2 Class Exercise 11
View eventloop-afdemp-4-2-class-exercise-11.markdown
@kostasx
kostasx / eventloop-afdemp-4-2-class-exercise-10.markdown
Created Feb 28, 2019
EventLoop | AfDEMP 4.2 Class Exercise 10
View eventloop-afdemp-4-2-class-exercise-10.markdown
@kostasx
kostasx / web-scraping-titles.js
Created Jan 8, 2019
Web Scraping for the lazy developer [ YouTube: https://youtu.be/yB_oh7WgRU8 ]
View web-scraping-titles.js
let result = Array.from( document.querySelectorAll("h3.section-title") )
.map( (title) => title.textContent.trim()).join("\n");
copy( result );
@kostasx
kostasx / insert-headers-and-footers-conditional.html
Last active Jan 4, 2019
Execute JavaScript on Specific Posts or Pages using the Insert Headers and Footers WordPress Plugin
View insert-headers-and-footers-conditional.html
<!-- Insert in the Footer Area of the Plugin: -->
<script>
if ( document.querySelector("body.postid-NUM") ){
// Code to be executed on the selected Post or Page with ID NUM goes here...
// Replace NUM with the ID Number of your Post or Page
}
</script>
@kostasx
kostasx / custom.js
Created Jan 3, 2019
WordPress Localized Scripts: Pass PHP data to JavaScript - The JavaScript code.
View custom.js
// Paste this code in a file inside your child theme's folder: /js/custom.js
jQuery(function($) {
alert( php_data.message );
});
@kostasx
kostasx / functions.php
Created Jan 3, 2019
WordPress Localized Scripts: Pass PHP data to JavaScript - The PHP code.
View functions.php
<?php
// Place this code in your child theme's functions.php file
function myprefix_enqueue_scripts() {
wp_enqueue_script(
'custom-script',
get_stylesheet_directory_uri() . '/js/custom.js'
);
wp_localize_script( 'custom-script', 'php_data', array(
@kostasx
kostasx / paste-ga-alternative-async-tracking-snippet.js
Last active Dec 20, 2018
Google Analytics JavaScript async Snippet to paste on the GA input field
View paste-ga-alternative-async-tracking-snippet.js
(function(){
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
var s = document.createElement('script');
s.setAttribute('async', true);
s.setAttribute('src', 'https://www.google-analytics.com/analytics.js');
var $head = document.getElementsByTagName('head');
You can’t perform that action at this time.