Skip to content

Instantly share code, notes, and snippets.

View estevanmaito's full-sized avatar

Estevan Maito estevanmaito

View GitHub Profile
let urls = $('a').toArray().map(a => $(a).attr('href'))
let images = $('img').toArray().map(img => $(img).attr('src'))
let css = $('link[rel="stylesheet"]').toArray().map(css => $(css).attr('href'))
let js = $('script').toArray().map(js => $(js).attr('src'))
import { CSSTransition as ReactCSSTransition } from 'react-transition-group'
import { useRef, useEffect, useContext } from 'react'
const TransitionContext = React.createContext({
parent: {},
})
function useIsInitialRender() {
const isInitialRender = useRef(true)
useEffect(() => {
@estevanmaito
estevanmaito / sharect-complete-2.html
Created February 5, 2020 17:58
The complete API of Sharect 2.0
<script src="https://unpkg.com/sharect@2.0.0/dist/sharect.js"></script>
<script>
Sharect.config({
facebook: true,
twitter: true,
twitterUsername: 'estevanmaito',
backgroundColor: '#C53364',
iconColor: '#fff',
selectableElements: ['p']
}).init();
@estevanmaito
estevanmaito / sharect-simple-2.html
Created February 5, 2020 17:55
The simplest way to start using Sharect 2.0
<script src="https://unpkg.com/sharect@2.0.0/dist/sharect.js"></script>
<script>
Sharect.init();
</script>
@estevanmaito
estevanmaito / redux.js
Created March 8, 2019 14:54
Redux study implementation
// There area lot more checks in the Redux lib but this gets the point across.
function createStore(reducer, initialState) {
let currentState = initialState;
const listeners = [];
function getState() {
return currentState;
}
function subscribe(listener) {
@estevanmaito
estevanmaito / books.md
Last active January 2, 2021 07:07
My books list
@estevanmaito
estevanmaito / settings.json
Created April 10, 2017 20:28
Visual Studio Code settings
{
"editor.fontSize": 19,
"editor.tabSize": 2,
"editor.fontFamily": "'Roboto Mono', monospace",
"editor.lineHeight": 28,
"keyboard.dispatch": "keyCode"
}
@estevanmaito
estevanmaito / sharect-complete.html
Last active March 22, 2019 21:39
The complete API of Sharect.
<script src="sharect.min.js"></script>
<script>
var sharect = new Sharect();
sharect.config({
facebook: true,
twitter: true,
twitterUsername: '@estevanmaito',
backgroundColor: '#ff4081',
iconColor: '#fff',
selectableElements: ['p', '.header', 'blockquote']
@estevanmaito
estevanmaito / sharect-simple.html
Created March 21, 2017 22:06
The simplest way to get started with Sharect.
<script src="sharect.min.js"></script>
<script>
var sharect = new Sharect();
sharect.init();
</script>
@estevanmaito
estevanmaito / .eslintrc.json
Created January 2, 2017 19:45
ESLint config file
{
"parserOptions": {
"sourceType": "module"
},
"env": {
"es6": true,
"node": true
},
"plugins": [
"html"