Skip to content

Instantly share code, notes, and snippets.

View marco-souza's full-sized avatar
🦕

Marco Antônio marco-souza

🦕
View GitHub Profile
@marco-souza
marco-souza / useLoadingMoked.ts
Last active January 14, 2020 23:44
mock a react hook
import { useLoadingMocked } from 'assets/__mocks__/useLoading';
// mock module as a function
jest.mock('src/redux/loading', () => jest.fn());
import methodToMock from 'src/redux/loading';
const mockedMethod = methodToMock as jest.Mock;
describe('testing a hook', () => {
it('my test', () => {
@marco-souza
marco-souza / admin.md
Last active January 4, 2020 19:49
Dev/Ops Sheets

authorize your local key

cat ~/.ssh/id_rsa.pub | ssh <user@host> 'cat >> .ssh/authorized_keys'

Add user

adduser <name>
@marco-souza
marco-souza / Component.jsx
Last active December 26, 2019 17:59
handle window scroll
const Comp = (props) => {
const myRef = useRef()
const [activeState, setActiveState] = useState(false)
const callbackTrue = () => {
// define callback
setActiveState(true)
}
const callbackFalse = () => {
@marco-souza
marco-souza / concat.jsx
Created December 11, 2019 21:46
concatReactComponent
const concatComponents = (...listComponents) => listComponents
const MyComp = (props) => {
const myConcatenatedText = concatComponents(
'My text with ',
<a>My link</a>,
'end of my text with',
)
return (
@marco-souza
marco-souza / deps
Created December 2, 2019 19:23
ink
react
ink
ink-text-input
typescript
@types/react
@types/node
state = [
action1,
action1,
]
// hook
const useFilterPedingAction = key => state.filter(item => (
item.status === 'pending' &&
item.name === key
))
@marco-souza
marco-souza / .zshrc
Created September 17, 2019 14:50
Use npm -g without sudo
# set npm env
export NPM_HOME=$HOME/.npm-global
npm config set prefix $NPM_HOME
# set node bin to path
export PATH=$PATH:$NPM_HOME/bin
@marco-souza
marco-souza / 1.sql
Last active September 12, 2019 16:39
CYW
/*
Enter your query here.
Please append a semicolon ";" at the end of the query
*/
SELECT c.name, MAX(p.id)
FROM customer as c, payment as p
WHERE p.status LIKE "CO" and p.customer_id = c.id
GROUP BY c.name
@marco-souza
marco-souza / 1.sql
Created September 12, 2019 16:14
CYW
/*
Enter your query here.
Please append a semicolon ";" at the end of the query
*/
SELECT c.name, MAX(p.id)
FROM customer as c, payment as p
WHERE p.status LIKE "CO" and p.customer_id = c.id
GROUP BY c.name
@marco-souza
marco-souza / email_signature.html
Last active September 12, 2019 13:55
My mail signature
</div>
<div>
<strong>Marco Antônio</strong>
<span style="margin: .8em">
<a style="text-decoration: none" href="https://linkedin.com/in/masouzajunior" title="LinkedIn" target="_blank">
<img width="13" height="13" src="https://www.getmailspring.com/signature-assets/linkedin.gif" alt="LinkedIn">
</a>
<a style="text-decoration: none" href="https://github.com/marco-souza" title="GitHub" target="_blank" >