Skip to content

Instantly share code, notes, and snippets.

@csalmeida
csalmeida / .dockerignore
Last active July 16, 2022 13:37
Rails Dockerfile
.git
tmp
!tmp/pids
log
public/assets
public/packs
.bundle
db/*.sqlite3
db/*.sqlite3-*
@csalmeida
csalmeida / README.md
Last active March 30, 2021 19:37
Using MutationObserver to listen to attribute changes

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

@csalmeida
csalmeida / javascript_let_const_scope.js
Last active December 3, 2020 15:50
JavaScript Scope Examples
/*
* 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 September 30, 2020 17:39 — forked from dasilvaluis/gulpfile.js
Gettext Scanner Gulp 4 Script for Twig Projects
/**
* Gettext Scanner Script for Twig Projects
* v1.3
*
* Developed by Luís Silva
* https://github.com/luism-s
*/
/**
* Purpose:
@csalmeida
csalmeida / bootstrap_partials.scss
Created July 28, 2020 18:15
Bootstrap SCSS Partials
// 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";