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 / .env.development.local
Created June 12, 2018 10:03
react-git-explorer-env
REACT_APP_CLIENT_ID=xxxxxxxxxx
REACT_APP_REDIRECT_URI=http://localhost:3000/
REACT_APP_GATEKEEPER_URI=https://xxxxxxx-xxxxx.herokuapp.com
@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 / index.html
Last active June 29, 2018 08:51
react-git-explorer_index
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
...
<title>React Git Explorer</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
</head>
@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',
@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 / 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 / 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 / backup-github.sh
Last active March 2, 2022 16:32 — forked from darktim/backup-github.sh
If you have more than 30 Repositories, the original script will not download all. The github api limits the entries to 30 per page but you can raise that up to 100. I have added a small loop which sets the limit to 90 and cycles through all pages until the listing on a page is empty...
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR="./gitbackup" # where to place the backup files
GHBU_ORG="ERS-HCL" # the GitHub organization whose repos will be backed up
GHBU_UNAME="<CHANGE ME>" # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD="<CHANGE ME>" # the password for that account
GHBU_GITHOST="https://github.com/" # the GitHub hostname (see notes)
GHBU_PRUNE_OLD=true # when `true`, old backups will be deleted
GHBU_PRUNE_AFTER_N_DAYS=3 # the min age (in days) of backup files to delete
@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"),