Skip to content

Instantly share code, notes, and snippets.

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

Jorge Garcia Georgge

🏠
Working from home
View GitHub Profile
@Georgge
Georgge / redux-actions.ts
Created February 21, 2022 06:10 — forked from milankorsos/redux-actions.ts
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
const certificateGenerator = (image, name, userName) => {
if (image) getBlob(image).then((blob) => {
const { base64 } = blob;
const doc = new jsPDF({
orientation: 'landscape',
})
const w = doc.internal.pageSize.getWidth();
const h = doc.internal.pageSize.getHeight();
doc.addImage(base64, 'JPEG', 0, 0, w, h);
@Georgge
Georgge / parse-jwt.js
Created May 8, 2019 17:47 — forked from Klerith/parse-jwt.js
Parse - JWT - Obtener Payload y fecha de creación y expiración
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.parse(window.atob(base64));
};
@Georgge
Georgge / When I forget to add something to the gitignore
Last active August 21, 2018 03:05
Remove something from the remote git repository after uploading it by mistake by updating the gitignore
update gitignore with the rules
git add .gitignore
git rm -r --cached some-directory
git commit -m 'Remove the now ignored directory "some-directory"'
git push origin master