git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
// https://letsbuildui.dev/articles/building-a-dropdown-menu-component-with-react-hooks | |
import { useState, useEffect, RefObject } from 'react'; | |
export const useDetectOutsideClick = (ref: RefObject<HTMLElement>, initialState: boolean) => { | |
const [isActive, setIsActive] = useState(initialState); | |
useEffect(() => { | |
const pageClickEvent = (event: MouseEvent) => { | |
// If the active element exists and is clicked outside of | |
if (ref.current !== null && !ref.current.contains(event.target as Node)) { |
import React from 'react' | |
import useIsElementInView from './useIsElementInView' | |
export function Example() { | |
const { ref, isInView } = useIsElementInView() | |
return ( | |
<div ref={ref}> | |
{isInView ? 'It is in the view!' : 'Not in view (so you cant really even tell if it works I guess...)'} | |
</div> |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
É um design pattern que o Rails implementa a partir da gem ActiveRecord.
Serve para conectar a camada Model da aplicação com tabelas do database, para assim criar um modelo de domínio persistível, onde a lógica (Model) e dados (BD) são apresentados em uma única solução.
Já persiste no BD:
obj.create
const fact = n => n && n * fact(n-1) || 1; | |
const decToBin = dec => dec && dec % 2 + 10 * decToBin(0 | dec / 2) || 0; | |
const iif = pr => t => f => x => pr(x) ? t(x) : f(x); | |
const not = fn => x => !fn(x); | |
const or = pra => prb => x => pra(x) || prb(x); | |
const isArray = x => x instanceof Array; | |
const isPromise = x => x instanceof Promise; | |
const isPlainObject = x => typeof x === 'object' && x !== null && x == '[object Object]'; | |
const isTraversable = or(isPlainObject)(isArray); | |
const keys = Object.keys.bind(Object); |
While attempting to explain JavaScript's reduce
method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.
JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List
is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it much simpler to think about both the old list and the new one, what they contain, and
git config --global alias.checkoutr checkout
nano /usr/local/share/zsh/site-functions/git-completion.bash
...and then modify the file as follows...
-__gitcomp_nl "$(__git_refs '' $track)"
+if [ "$command" = "checkoutr" ]; then
+ __gitcomp_nl "$(__git_refs '' $track)"
+else
http://appcamp.io/courses/user-interface/layout-simple
http://thompsonemerson.github.io/ionic-collection/
## ionic examples
ionic start ionicApp
ionic start blankApp blank
ionic start tabsApp tabs
<!-- | |
Subistitua o Número(8888387788) pelo seu número do WhatsApp | |
Siga este padrão: DDD + Numero, ex: 88 8838 7788 (Meu Número Whats) | |
--> | |
<a href="intent://send/8888387788#Intent;scheme=smsto;package=com.whatsapp;action=android.intent.action.SENDTO;end">Vamos Conversar?</a> |