Skip to content

Instantly share code, notes, and snippets.

View tomickigrzegorz's full-sized avatar
:octocat:
work and work ...

Grzegorz Tomicki tomickigrzegorz

:octocat:
work and work ...
View GitHub Profile
/* Inline script printed out in the header */
add_action('wp_head', 'inpost_script_javascript', 9);
function inpost_script_javascript()
{
if (is_checkout()) {
?>
<script src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script>
<style>
.hidden-inpost {
display: none;
@tomickigrzegorz
tomickigrzegorz / 1.js
Created February 21, 2021 15:52 — forked from chrisbuttery/1.js
Fade in / Fade out
// fade out
function fade(el) {
var op = 1;
var timer = setInterval(function () {
if (op <= 0.1){
clearInterval(timer);
el.style.display = 'none';
}
el.style.opacity = op;
@tomickigrzegorz
tomickigrzegorz / addRemoveClass.js
Created September 30, 2020 15:30
Add/Remove class function
function addRemoveClass(element, className, type) {
element.classList[type ? 'add' : 'remove'](className);
}
@tomickigrzegorz
tomickigrzegorz / navigator
Created September 27, 2020 19:22
navigator.share test on desctop browser
chrome://flags/#enable-experimental-web-platform-features
@tomickigrzegorz
tomickigrzegorz / types.txt
Last active September 27, 2020 19:23
types based on js
npx typescript sources/index.js --declaration --allowJs --emitDeclarationOnly --outDir types
npx browserslist@latest --update-db

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

followActiveElement = (element, container) => {
if (element.offsetTop < container.scrollTop) {
container.scrollTop = element.offsetTop;
} else {
const offsetBottom = element.offsetTop + element.offsetHeight;
const scrollBottom = container.scrollTop + container.offsetHeight;
if (offsetBottom > scrollBottom) {
container.scrollTop = offsetBottom - container.offsetHeight;
}
}
// .index() jquery in vanilla js
// jQuery
$('.radio').index(e.currentTarget);
// Native
Array.from(document.querySelectorAll('.radio')).indexOf(e.currentTarget);
or
Array.prototype.indexOf.call(document.querySelectorAll('.radio'), e.currentTarget);
@tomickigrzegorz
tomickigrzegorz / subtitle-extract.md
Created July 13, 2020 19:36 — forked from pavelbinar/extract-subtitles-from-mkv.md
Extract subtitles from .mkv files on Mac OS X

Extract Subtitles From .mkv

These instructions shall work on Mac OS X and Linux.

Install mkvtoolnix (Mac OS X)

Installation via Homebrew:

brew install mkvtoolnix