Skip to content

Instantly share code, notes, and snippets.

View jhonnymichel's full-sized avatar
🏠
Working from home

Jhonny Michel jhonnymichel

🏠
Working from home
View GitHub Profile
@jhonnymichel
jhonnymichel / credit_card.js
Last active July 7, 2023 06:28
CIBC to Lunch Money CSV
// get the table
let table = document.querySelector('table.ember-view');
// get rows
let rows = Array.from(table.querySelectorAll('tbody tr.transaction-row')).map(
(tr) => {
let date = tr.querySelector('.transactionDate span').innerText.trim();
let description = tr
.querySelector('span.transactionDescription')
.innerText.trim();
export function useStore() {
const [ state, set ] = useState(store.state);
if (!store.setters.includes(set)) {
store.setters.push(set);
}
useEffect(() => () => {
store.setters = store.setters.filter(setter => setter !== set)
}, [])
@jhonnymichel
jhonnymichel / hookstore-snippet-useStore.jsx
Last active November 22, 2019 09:49
hookstore-snippet-useStore
import { store, useStore } from './hookstore';
// setting the store initial state
store.state = 0;
function StatefulHello() {
// using the useStore hook
const [timesClicked, updateTimesClicked] = useStore();
return (
@jhonnymichel
jhonnymichel / hookstore.js
Last active March 27, 2019 01:41
hookstore.js
import { useState } from 'react';
export const store = {
state: {},
setState(value) {
this.state = value;
this.setters.forEach(setter => setter(this.state));
},
setters: []
};
function StatefulHello() {
const [timesClicked, updateTimesClicked] = useState(0);
return (
<div>
<h1>Hello, component!</h1>
<h2>The button inside this component was clicked {timesClicked} times</h2>
<button type="button" onClick={() => updateTimesClicked(timesClicked + 1)}>
Update
</button>
@jhonnymichel
jhonnymichel / hookstore-snippet-useState.jsx
Last active November 3, 2018 18:10
Hookstore Snippet 1: useState
import React, { useState } from 'react';
function StatefulHello() {
const [timesClicked, updateTimesClicked] = useState(0);
return (
<div>
<h1>Hello, world!</h1>
<h2>The button inside this component was clicked {timesClicked} times</h2>
<button
@jhonnymichel
jhonnymichel / pc.md
Last active November 3, 2018 15:00
PC

Pra vídeo editing o peso dos componentes são

  • Tier 1: Processador e Ram
  • Tier 2: Videocard.

Pra um PC gamer, o peso dos componentes é inverso, então é só comprar a placa de vídeo mais cara e o processador com custo benefício pra focar mais em james

CPU

Melhor opção mas aperta o budget

@jhonnymichel
jhonnymichel / gamedev-trigonometry.md
Last active September 20, 2023 16:57
Basic trigonometry for game development

Introduction

two distinct points (for example, a game object position and the mouse cursor position) in an area can always be two corners of a Right Triangle (Triângulo-retângulo in ptbr). A triangle has three sides: The Hypotenuse, the Adjacent and the Opposite.

The distance between two points in the X axis corresponds to the Adjacent side of a triangle, The distance between two points in the Y axis corresponds to the Opposite side of a triangle.

The Hypotenuse is the shortest distance between the two points.

This means we can use trigonometry to handle many interactions between objects when programming visual stuff.