Skip to content

Instantly share code, notes, and snippets.

View adriancbo's full-sized avatar
🎯
Focusing

Adrian Carballo adriancbo

🎯
Focusing
View GitHub Profile
@ktsn
ktsn / migrate.ts
Last active June 23, 2021 15:00
Migration script from Apollo codegen to GraphQL Code Generator
import * as fs from 'fs'
import * as path from 'path'
import * as globby from 'globby'
import { parseComponent } from 'vue-template-compiler'
import { format } from 'prettier'
import { parse } from '@babel/parser'
import traverse from '@babel/traverse'
import generate from '@babel/generator'
const graphqlCodeGenFile = '../src/generated/graphql.ts'
@gmjelle
gmjelle / apiWalmart.js
Last active September 15, 2024 16:23
import NodeRSA from "node-rsa";
const keyData = {
consumerId: "CONSUMER_ID",
privateKey: `-----BEGIN RSA PRIVATE KEY-----
MY PRIVATE KEY
-----END RSA PRIVATE KEY-----`,
keyVer: 1,
impactId: "YOUR IMPACT AFFILIATE ID" // not required
},
# Source: https://gist.github.com/fca66711eaf0440483eba42ee013311a
#####################################
# How to Apply GitOps to Everything #
# Combining Argo CD and Crossplane #
# https://youtu.be/yrj4lmScKHQ #
#####################################
# Referenced videos:
# - Argo CD - Applying GitOps Principles To Manage Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4
const nodeRSA = require('node-rsa');
const fetch = require('node-fetch');
const publicKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbM2br48JS2JJy8Ajy0gy33Gu5RNAFgysUp4Mj9FqzXWg7AwdGaXc0vIAGG3vmyrP906qJpiEV1aW9GhsEGNQ9Mjmngfnu1VAKZjskVToqG1ktiXZJKSlVUfGTYj+r1lKDgd2iKt4azIzoeElk1gnLovn8zEaiCT7prHlzWWb7JgW3qp1e12e5WvSC5xX9P5iKOs6WM3qTSAX3e8qGeA9wtlHdQuDjSjWA0WlYQIFKgpoCBNZeldNxel79QgR7QKG6Oo/H4aImhDW9vXH00mGVy9QX11ngovVYPhCQWzsAo+v+Y2lAJUtFdjr2t9/mJisKxpYvpMeqVo2ZSydwBmb5'
const consumerId = 'change this to your consumer id'
const privateKey = "MIIEpAIBAAKCAQEAmzNm6+PCUtiScvAI8tIMt9xruUTQBYMrFKeDI/Ras11oOwMH\
Rml3NLyABht75sqz/dOqiaYhFdWlvRobBBjUPTI5p4H57tVQCmY7JFU6KhtZLYl2\
SSkpVVHxk2I/q9ZSg4HdoireGsyM6HhJZNYJy6L5/MxGogk+6ax5c1lm+yYFt6qd\
XtdnuVr0gucV/T+YijrOljN6k0gF93vKhngPcLZR3ULg40o1gNFpWECBSoKaAgTW\
XpXTcXpe/UIEe0ChujqPx+GiJoQ1vb1x9NJhlcvUF9dZ4KL1WD4QkFs7AKPr/mNp\
import React, { FC, useState } from 'react';
import Transition from '../../utils/transition';
const Test: FC<{}> = () => {
const [open, setOpen] = useState(true);
const handleOpen = (): void => {
setOpen(true);
};
@atomiks
atomiks / LazyTippy.jsx
Last active March 24, 2025 01:14
Lazy Tippy
// Will only render the `content` or `render` elements if the tippy is mounted to the DOM.
// Replace <Tippy /> with <LazyTippy /> component and it should work the same.
const LazyTippy = forwardRef((props, ref) => {
const [mounted, setMounted] = useState(false);
const lazyPlugin = {
fn: () => ({
onMount: () => setMounted(true),
onHidden: () => setMounted(false),
@nksaraf
nksaraf / graphql-fetch.ts
Last active October 3, 2022 20:08
React Query with GraphQL
// Taken mostly from prisma-labs/graphql-request
import "isomorphic-unfetch";
import { print } from "graphql/language/printer";
import { DocumentNode } from "graphql";
export type Variables = { [key: string]: any };
export interface Headers {
[key: string]: string;
}
@seandearnaley
seandearnaley / index.ts
Last active April 3, 2020 06:55
Example Index.ts
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import {
ApolloClient,
ApolloProvider,
HttpLink,
InMemoryCache,
} from '@apollo/client';
@seandearnaley
seandearnaley / codegen.yml
Last active April 3, 2020 02:31
codegen.yml
overwrite: true
schema: "http://localhost:4000/graphql"
documents: src/**/*.graphql
generates:
src/generated/graphql.ts:
hooks:
afterOneFileWrite:
- prettier --write
plugins:
- "typescript"
@rsevil
rsevil / applinks_dynamiclinks_proxy.js
Last active October 18, 2023 02:35
Dynamic links - Applinks integration