Skip to content

Instantly share code, notes, and snippets.

View tsukhu's full-sized avatar
🎯
Focusing

Tarun Kumar Sukhu tsukhu

🎯
Focusing
View GitHub Profile
@tsukhu
tsukhu / index.html
Created November 3, 2022 05:33
pinser tw ethers login
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pinser + TW + Ethers.js</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
@tsukhu
tsukhu / tw-subscription.tsx
Last active March 14, 2022 02:20
Tailwind version of the remix.run newsletter subscription sample
// Based on the Remix Single (https://www.youtube.com/watch?v=jd_bin5HPrw&list=PLXoynULbYuEDG2wBFSZ66b85EIspy3fy6)
import { Transition } from '@headlessui/react';
import { CheckIcon, RefreshIcon } from '@heroicons/react/outline';
import { useEffect, useRef } from 'react';
import {
ActionFunction,
Form,
Link,
useActionData,
@tsukhu
tsukhu / insights.tsx
Last active March 3, 2022 12:47
Nivo Charts with remix.run
import { LoaderFunction, useLoaderData } from "remix";
import useResizeObserver from "use-resize-observer";
import MyResponsiveAreaBump from "~/components/charts/AreaBump";
import MyResponsiveBarCanvas from "~/components/charts/BarCanvas";
import MyResponsiveChordCanvas from "~/components/charts/ChordCanvas";
import MyResponsiveNetworkCanvas from "~/components/charts/NetworkCanvas";
export const loader: LoaderFunction = async ({ params }) => {
let result = await Promise.all([
fetch("http://localhost:3100/bar"),
@tsukhu
tsukhu / host_reactjs_component.js
Last active September 12, 2020 08:42
WP5 dynamically load VueJS remote in a React JS Host
// Dynamically mount
// loadComponent('myvueapp','./FullApp','myid')
function loadComponent(scope, module,divId ) {
window[scope].get(module).then((m) => {
m().default(`#${scope}-app-${divId}`);
});
}
@tsukhu
tsukhu / machine.js
Last active July 14, 2020 07:01
Generated by XState Viz: https://xstate.js.org/viz
const dataMachine = new Machine({
id: "posts",
initial: "ready",
context: {
data: [],
},
states: {
ready: {
on: {
FETCH_POSTS: "fetching"
@tsukhu
tsukhu / Steps.md
Last active November 14, 2023 07:07
create-react-app with styled components

Here are the steps to convert the create-react-app generated to code to use styled components instead of css

  1. Created an app using create-react-app
create-react-app react-styledcomponents-app
  1. Install styled-components as a dependency
@tsukhu
tsukhu / repoList.js
Created June 12, 2018 11:28
react-git-explorer-repoList
import React, { Component } from 'react';
import { Container } from 'reactstrap';
import GitCards from '../gitCards/gitCards';
import './repoList.css';
/**
* Display the github repository data in a Cards based grid view
*/
class RepoList extends Component {
constructor(props, context) {
@tsukhu
tsukhu / repoContainer.js
Last active June 29, 2018 09:17
react-git-explorer-repoList
import { Query } from 'react-apollo';
import { CSVLink } from 'react-csv';
import { GET_CURSOR_ORG_DATA, GET_ORG_DATA } from '../../graphql/queries';
<Query query={GET_ORG_DATA} variables={{ org: org }} errorPolicy="ignore">
{({ loading, error, data, fetchMore }) => {
if (error) return `Error! ${error.message}`;
// Total available org repositories
const totalCount = data.organization
@tsukhu
tsukhu / queries.js
Last active June 29, 2018 08:59
react-git-explorer-gql
import { gql } from 'apollo-boost';
const GET_CURSOR_ORG_DATA = gql`
query($cursor: String, $org: String = "") {
organization(login: $org) {
repositories(
first: 50
after: $cursor
orderBy: { field: PUSHED_AT, direction: DESC }
) {
@tsukhu
tsukhu / app.js
Last active June 29, 2018 09:08
react-git-explorer-appjs
import ApolloClient from 'apollo-boost';
import { ApolloProvider } from 'react-apollo';
render() {
// console.log(this.state.org);
const client =
this.state.token &&
new ApolloClient({
uri: 'https://api.github.com/graphql',
errorPolicy: 'ignore',