Skip to content

Instantly share code, notes, and snippets.

View julioxavierr's full-sized avatar
🦄
raising unicorns

Julio Xavier julioxavierr

🦄
raising unicorns
  • Brazil
View GitHub Profile
@alexanderson1993
alexanderson1993 / AlertDialogProvider.tsx
Created April 2, 2023 19:07
A multi-purpose alert/confirm/prompt replacement built with shadcn/ui AlertDialog components.
"use client";
import * as React from "react";
import { Input } from "@/components/ui/Input";
import { Button } from "@/components/ui/Button";
import {
AlertDialog,
AlertDialogContent,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogDescription,
import React from 'react';
import { render, waitFor, screen, act } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import StackedBar from '~/pages/NewReports/Cards/StackedBar';
import { dashData } from './dashData';
let listener = null;
@julioxavierr
julioxavierr / ts-migrate.js
Created January 27, 2022 20:59
Migrate JS file to TS
var join = require('path').join;
var cp = require('child_process');
/**
* Migrate a file to TypeScript.
*
* @example
* // will rename file and try to infer types
* yarn ts:migrate ./src/utils.js
*
import { graphql } from 'react-relay';
import { getNode } from 'relay-runtime';
const ShoesListQuery = graphql`
query ShoesListQuery {
shoes {
size
type
}
}
@xvaara
xvaara / postgraphiql.ts
Last active October 28, 2021 06:06
Dark mode for PostgraphiQL
const graphiqlBrandingTweak = {
["postgraphile:graphiql:html"](html: string) {
console.log("Applying GraphiQL Branding Tweak...");
return html.replace(
"</head>",
`<style type="text/css">
@media (prefers-color-scheme: dark) {
html {
filter: invert(1) hue-rotate(180deg);
}
@jgcmarins
jgcmarins / mapboxToAddress.ts
Created January 30, 2020 21:46
Mapbox helpers
import idx from 'idx';
import { ForwardFeature } from './mapboxTypes';
export interface AddressResult {
id?: string | null;
fullAddress?: string | null;
shortAddress?: string | null;
zipcode?: string | null;
street?: string | null;
@mmazzarolo
mmazzarolo / scale.ts
Last active December 23, 2019 14:51
React-Native metrics scaling
import { PixelRatio, Dimensions } from "react-native";
const isTabletLike = () => {
const pixelDensity = PixelRatio.get();
const adjustedWidth = Dimensions.get("screen").width * pixelDensity;
const adjustedHeight = Dimensions.get("screen").height * pixelDensity;
return (
(pixelDensity < 2 && (adjustedWidth >= 1000 || adjustedHeight >= 1000)) ||
(pixelDensity === 2 && (adjustedWidth >= 1920 || adjustedHeight >= 1920))
);
@sibelius
sibelius / relay.config.js
Created November 17, 2019 00:58
Relay Config that works well with monorepo, you can spread your fragments in many packages
module.exports = {
schema: './data/schema.graphql',
language: 'typescript',
src: '../.',
include: [
'./web/src/**',
'./shared/src/**',
],
};
@tcodes0
tcodes0 / links-and-cool-hacks.txt
Last active February 7, 2024 16:07
LINKS AND COOL HACKS