Skip to content

Instantly share code, notes, and snippets.

View danielnass's full-sized avatar
🚀
Ship it!

Daniel Nass danielnass

🚀
Ship it!
View GitHub Profile
@danielnass
danielnass / PATCH.md
Last active April 2, 2024 11:15
Flora & Stiches GAMBIARRA

O pacote Stitches que o Flora utiliza possui diversas correções e melhorias não lançadas, apenas buildadas, inclusive compatbilidade com a versão do TypeScript mais recente. As issues relacionadas ao problema do TS aqui e aqui.

Nesse passo a passo ensino como você pode aproveitar essas melhorias e também corrigir o problema do TypeScript The type of this node cannot be serialized because its property '[$$PropertyValue]' cannot be serialized, que acontece quando queremos usar o TypeScript 4.8+ e exportar um componente de um arquivo, como pode ser visto na imagem a seguir.

Captura de Tela 2023-07-18 às 17 13 14

Algumas threads já foram levantadas no Slack sobre a incopatibilidade

@danielnass
danielnass / bug_fix.md
Last active June 15, 2023 16:02
Pull Request Templates

🐞 The problem

What is happening 🔥 What is causing it 🔥

👣 Steps to reproduce

How to reproduce the bug step by step

🧑‍💻 The fix

@danielnass
danielnass / gist:d41d47a9b6e05918a56c
Created February 5, 2015 21:46
jQuery Validation Additional Method CNH - Carteira Nacional de Habilitação - Carteira de Motorista
$.validator.addMethod('CNH', function(value, element) {
var ret,
cnh = value,
firstChar = cnh.charAt(0);
if (cnh.replace(/[^\d]/g, '').length === 11 && firstChar.repeat(11) !== cnh) {
var dsc = 0;
for (var i = 0, j = 9, v = 0; i < 9; ++i, --j) {
@danielnass
danielnass / javascriptArrayReduceFromScratch.js
Created October 11, 2022 02:10
JavaScript Array Reduce from Scratch
// 1 - Create reduce function
function reduce(arr, fn, acc){
// 5 - Iterate over each array value and reduce it with the accumulator into only one, assigning the result to the accumulator
for(value of arr){
acc = fn(value, acc);
}
// 6 - Return the accumulator after iterates over each value of the array
return acc;
@danielnass
danielnass / javascriptAsyncAwaitFromScratch.js
Last active October 11, 2022 01:43
JavaScript Async Await from scratch
function doWhenDataReceived(value){
// 4 - Call .next() passing the value from the Promise
fetchFlow.next(value);
}
function* createFlow(){
// 5 - Assign the Promise fullfiled value to data const
const data = yield fetch('https://twitter.com/api/paca/tweets');
// 6 - Console log the data value from the Promise
console.log(data);
@danielnass
danielnass / javascriptArrayMapFromScratch.js
Created October 11, 2022 01:43
JavaScript Array Map From Scratch
// 1 - Create map function
function map(array, fn){
let newArr = [];
for (value of array){
newArr.push(fn(value));
}
return newArr;
}
@danielnass
danielnass / moveZeroesToEend.js
Created August 3, 2022 18:43
JavaScript - Move zeroes to end of the array
const arr = [0,1,0,2,0,3,0,4,0,5];
const arrZeroesFiltered = arr.filter((cv) => cv !== 0);
/*
* or if you know your arr will return just numbers
* and not things like null or undefined
* const arrZeroesFiltered = arr.filter(Boolean);
*/
const zeroes = arr.length - arrZeroesFiltered.length;
@danielnass
danielnass / search-react-component-by-name-regex.js
Created May 2, 2022 23:18
Regex for searching a React component by their name. Search just for the specific name, excluding extensions.
/* Search only for the specific name, excluding name extensions
** This example below will found
**
** <Anchor>Anchor Text</Anchor>
**
** <Anchor booleanProp>Anchor Text</Anchor>
**
** <Anchor prop="text">Anchor Text</Anchor>
**
** <Anchor prop={localProp}>Anchor Text</Anchor>
#!/bin/bash
while $@; do :; done
@danielnass
danielnass / brew-cask.sh
Last active August 1, 2020 18:56
Brew Cask list
aerial iterm2
epic-games java
figma jetbrains-toolbox
firecamp microsoft-edge
firefox phantomjs
firefox-developer-edition spotmenu
firefox-nightly steam
font-fira-code stremio
font-jetbrains-mono tidal
google-chrome transmission