Skip to content

Instantly share code, notes, and snippets.

@csalmeida
csalmeida / README.md
Last active Mar 30, 2021
Using MutationObserver to listen to attribute changes
View README.md

Mutation Observer Example

This is a working example of using the MutationObserver API to listen to changes in an DOM element's attributes.

Clicking the button triggers a change and in turn MutationObserver will notice the change. Logs available in the console.

Resources

View javascript_let_const_scope.js
/*
* How Javascript scope works using let and const
* It is more restrictive as to where values can be accessed within functions and blocks
*/
// This variable can be accessed from anywhere.
const globalScopeVar = 'Can be accessed from anywhere (global scope)';
function parentScope() {
// This variable can only be accessed within this function and its child function and code blocks.
@csalmeida
csalmeida / gulpfile.js
Last active Sep 30, 2020 — forked from luism-s/gulpfile.js
Gettext Scanner Gulp 4 Script for Twig Projects
View gulpfile.js
/**
* Gettext Scanner Script for Twig Projects
* v1.3
*
* Developed by Luís Silva
* https://github.com/luism-s
*/
/**
* Purpose:
View bootstrap_partials.scss
// Required:
@import 'node_modules/bootstrap/scss/functions';
@import 'node_modules/bootstrap/scss/mixins';
@import "node_modules/bootstrap/scss/variables";
// Optional, comment out or remove leaving the only ones needed:
@import "node_modules/bootstrap/scss/root";
@import "node_modules/bootstrap/scss/reboot";
@import "node_modules/bootstrap/scss/type";
@import "node_modules/bootstrap/scss/images";