Skip to content

Instantly share code, notes, and snippets.

View simaodeveloper's full-sized avatar
🧑‍💼
Focused!

Daniel Simão simaodeveloper

🧑‍💼
Focused!
View GitHub Profile
@simaodeveloper
simaodeveloper / tddtalks.json
Last active December 8, 2020 02:34
Learning About Front-End Unit Test
{
"talks": [
{
"title": "Unit Testing Front-end Code",
"url": "https://www.youtube.com/watch?v=VSXGu73MiPg",
"author": "Michael Jasper"
},
{
"title": "Testing Front-end Code the Right Way",
"url": "https://www.youtube.com/watch?v=zF1hlOxucHE",
const { fromEvent } = Rx;
const { map, pluck } = RxOperators;
const input = document.createElement('input');
const container = document.querySelector('.container');
container.appendChild(input)
const observable = fromEvent(input, 'input')
.pipe(
//map(event => event.target.value),
@simaodeveloper
simaodeveloper / whichtype.js
Created July 3, 2020 19:12
A tiny library to help test the type of a value
const firstLetterUpperCase = str =>
str.replace(/(^\w)/, m => m.toUpperCase());
const firstLetterLowerCase = str =>
str.replace(/(^\w)/, m => m.toLowerCase());
const toString = value =>
Object.prototype.toString.call(value);
const isType = (type, value) =>
# Front-end
npm i -D jest husky lint-staged standard rollup babel-jest @babel/core @babel/preset-env @commitlint/config-conventional @commitlint/cli
# babel.config.js
```
module.exports = {
presets: [
[
'@babel/preset-env'
],
pex.add({
name: 'Accordion',
init: (_elements, options) => {
const elements = Array.from(_elements);
// tools
const isTitle = target => target.classList.contains('accordion__title');
const isOpen = target => target.classList.contains('accordion--open');