Skip to content

Instantly share code, notes, and snippets.

View jdjuan's full-sized avatar
:octocat:

Juan Herrera jdjuan

:octocat:
View GitHub Profile
@jdjuan
jdjuan / one-trust.ts
Created September 22, 2022 14:27
Read OneTrust Cookies
const cookie =
"'WATRC=2D0FDD6D-6F29-49E6-AEE0-42080FAA8120; _ga_6NJJBYQCBV=GS1.1.1658756504.1.1.1658756505.59; _gcl_au=1.1.2054335917.1659447846; _ga_Y9TTEFYVZC=GS1.1.1662476698.1.1.1662478229.0.0.0; _ga_TW3TH3JW1S=GS1.1.1662477516.1.1.1662478229.0.0.0; _ga_M0YDYEWKG9=GS1.1.1662477395.1.1.1662478229.0.0.0; _ga_MF7T4Q7V2G=GS1.1.1662477370.1.1.1662478229.0.0.0; _ga_ZE6FQL0YJS=GS1.1.1663668306.2.1.1663668449.0.0.0; _ga=GA1.2.402987297.1658756505; _gid=GA1.2.534896851.1663742869; WANV=AA2512FF-2F73-448D-8675-6A3DA6184C9F; OptanonAlertBoxClosed=2022-09-22T07:22:21.804Z; OptanonConsent=isGpcEnabled=0&datestamp=Thu+Sep+22+2022+09%3A22%3A22+GMT%2B0200+(Mitteleurop%C3%A4ische+Sommerzeit)&version=6.36.0&isIABGlobal=false&hosts=&consentId=f51c839a-cd58-489e-9f9c-e8a6e3931a0d&interactionCount=8&landingPath=NotLandingPage&groups=C0001%3A1%2CC0002%3A0%2CC0004%3A0&geolocation=%3B&AwaitingReconsent=false'";
function getOneTrustGrants(cookies) {
const escapedCookies = decodeURIComponent(cookies);
const result = escape
@jdjuan
jdjuan / react.md
Last active April 3, 2023 16:02
React Setup

React Lessons

  • Use Recoil for state management early on. It's too simple not to do it
  • Falsy values still render in in-line conditions. Always !! expressions that might not be boolean
  • Use default values for Enums, or ordering will change values
  • With event handlers, make sure to use an arrow function to avoid having to use .bind
  • If you want a component not to render, return null
  • Create interfaces first for the backend and the frontend
  • Define components (p, h1,h2,h3,h4) and mark them in the designs (with variants)
  • Put links in a common place
@jdjuan
jdjuan / PULL_REQUEST_TEMPLATE.md
Last active July 12, 2021 06:51
Pull Request Template
@jdjuan
jdjuan / wait.ts
Created March 29, 2020 10:41
Improve readability of setTimeout(fn, 0)
wait(): Promise<void> {
return new Promise((resolve: () => void): void => {
setTimeout(resolve);
});
}
{
"printWidth": 120,
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "es5",
"semi": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"proseWrap": "never"
@jdjuan
jdjuan / ego.md
Last active December 10, 2019 05:15

1. What is it?

The ego is an idea of yourself rooted on the opinion of others. It is an identity that serves as a preliminary answer to the question: "Who am I?".

A lot of vital aspects of your life derive from this identity such as your purpose, goals, and dreams. Pretty much the reasons to wake up every morning. When your ego is questioned and jeopardized, the aforementioned aspects are also shaken, and it feels awful.

To cope with this condition people constantly look for ways to reinforce their ego, to confirm their identity, and this process is called validation.

2. Ego Validation

@jdjuan
jdjuan / emotional-recipes.md
Last active May 16, 2019 21:08
Emotional Recipes

Emotional Recipes

Little steps are usually more effective at talking the brain into an idea than immediate spontaneous commands. Use these three recipes when necessary:

  1. 🆘 Urgent Recovery: For tough times full of anxiety or depression
  2. 🤕 Ego Validation: For when your ego is hurt
  3. 💼 Productivity Negotiation: For when you are being lazy for too long

1. Urgent Recovery 🆘

@jdjuan
jdjuan / ngcolombia-checklist.md
Last active November 11, 2019 22:40
Checklist for NgColombia Communities 🚀

NgColombia Checklist

💻 = If Workshop

3 Months before 😁

  • Pick a date and book the venue. Make sure it has: Internet, A/C, Coffee, comfortable chairs, good video beam, easy access, mics, etc.

2 Months before 😀

@jdjuan
jdjuan / crucial-conversations.md
Created November 27, 2018 02:50
Crucial Conversations Summary

Crucial Conversations

Summary

1. Prepare, 2. Speak, 3. Resist, 4. Build, 5. Decide

  1. Prepare: Purpose, Facts, Story, and start question
  2. Speak:
    1. Share the facts
  3. Tell the story, without assuming veracity
@jdjuan
jdjuan / culture.md
Last active April 21, 2021 23:38
Corporate Culture Summary

Corporate Culture

img

1. What is it?

Set of values and beliefs that define what is encouraged, discouraged, accepted, or rejected within an organization.

When properly aligned with personal values, drives, and needs, culture can unleash tremendous amounts of energy toward a shared purpose and foster an organization’s capacity to thrive.