Skip to content

Instantly share code, notes, and snippets.

View drenther's full-sized avatar
🏠
Working from home

Soumyajit Pathak drenther

🏠
Working from home
View GitHub Profile
name: PlanetScale Migration
on:
pull_request:
types: [opened, synchronize]
paths:
- packages/shared/db/schema.prisma
env:
PLANETSCALE_ORG: your-ps-org
PLANETSCALE_DB: your-db-name
@drenther
drenther / machine.js
Last active January 6, 2021 16:58
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@drenther
drenther / index.html
Created April 7, 2020 11:19
Example of Spot Panel Ports Example to show inconsistencies in Spot Panel ports // source https://jsbin.com/kixawuh
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Example to show inconsistencies in Spot Panel ports">
<title>Example of Spot Panel Ports</title>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/gojs/2.1.9/go.js"></script>
<script id="code">
function init() {
const $ = go.GraphObject.make;
header.navbar {
height: 40px;
margin: 5px 20px;
}
div.menu .menu-item.tile.tile-centered {
margin-top: 5px;
}
.menu.hero-list {
@drenther
drenther / utils.js
Created March 5, 2019 19:55
Final utils.js
import { HEROES, COMICS } from './data';
// the Knuth shuffle algorithm
export function shuffle(array) {
let currentIndex = array.length;
let temporaryValue;
let randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
@drenther
drenther / App.js
Last active March 5, 2019 19:47
Final App.js
import React from 'react';
import { DragDropContext } from 'react-beautiful-dnd';
import { HEROES, COMICS } from './custom/data';
import { shuffle, getTimeLeft, move, GAME_STATE } from './custom/utils';
import Modal from './components/Modal';
import Header from './components/Header';
import Dropzone from './components/Dropzone';
import Footer from './components/Footer';
/** App.js **/
import React from 'react';
import { DragDropContext } from 'react-beautiful-dnd';
import { HEROES, COMICS } from './custom/data';
import { shuffle, move, GAME_STATE } from './custom/utils';
import Modal from './components/Modal';
import Header from './components/Header';
@drenther
drenther / Dropzone.js
Created March 5, 2019 18:30
Dropzone component
/** components/Dropzone.js **/
import React from 'react';
import { Droppable, Draggable } from 'react-beautiful-dnd';
const Dropzone = ({ isDropDisabled, heroes, id }) => (
<div className="column col-4">
<div className="divider" data-content={id.toUpperCase()} />
<Droppable droppableId={id} isDropDisabled={isDropDisabled}>
{provided => {
@drenther
drenther / App.js
Last active March 5, 2019 20:25
The App component render function
class App extends React.Component {
render() {
const { gameState, timeLeft, bench, ...groups } = this.state;
const isDropDisabled = gameState === GAME_STATE.DONE;
return (
<>
<Header gameState={gameState} timeLeft={timeLeft} endGame={this.endGame} />
{this.state.gameState !== GAME_STATE.PLAYING && (
<Modal