Skip to content

Instantly share code, notes, and snippets.

View JayBee007's full-sized avatar

Javed JayBee007

  • Moscow
View GitHub Profile
@JayBee007
JayBee007 / machine.js
Last active September 11, 2021 09:45
Generated by XState Viz: https://xstate.js.org/viz
const timerMachine = Machine({
id: 'timerMachine',
initial: "paused",
context: {
totalRounds: 2,
roundsLeft: 2,
roundDuration: 15,
intervalDuration: 10,
fightSecondsLeft: 15,
intervalSecondsLeft: 10
@JayBee007
JayBee007 / machine.js
Last active September 11, 2021 07:00
Generated by XState Viz: https://xstate.js.org/viz
const timerMachine = Machine({
id: 'timerMachine',
initial: "paused",
context: {
secondsLeft: 5
},
states: {
paused: {
on: {
START: {
@JayBee007
JayBee007 / machine.js
Last active September 11, 2021 06:54
Generated by XState Viz: https://xstate.js.org/viz
const timerMachine = Machine({
id: 'timerMachine',
initial: "paused",
states: {
paused: {
on: {
START: {
target: 'running'
}
}
@JayBee007
JayBee007 / configuration-1.js
Created August 21, 2019 10:13 — forked from patrickkunka/configuration-1.js
Configuration Patterns
/**
* Configuration #1: Basic Configuration Class
*
* A basic example utilising a sealed instance of a configuration
* class, with user-provided options merged in upon instantation
* of the implementation.
*/
class Config {
constructor() {
@JayBee007
JayBee007 / bash
Created January 1, 2019 14:16
Untrack files already added to git repository based on .gitignore
git rm --cached foo.txt
@JayBee007
JayBee007 / messages.hooks.js
Created November 21, 2018 19:55 — forked from sicruse/messages.hooks.js
Example use of feathers-sequelize object hydration
const hydrate = require('feathers-sequelize/hooks/hydrate');
function includePoster() {
return function (hook) {
const model = hook.app.service('users').Model;
const association = { include: [{ model: model, as: 'poster', attributes: ['userId', 'displayName', 'avatar'] }] };
switch (hook.type) {
case 'before':
hook.params.sequelize = Object.assign(association, { raw: false });
@JayBee007
JayBee007 / client.js
Last active January 14, 2024 15:48
Trying to Setup GraphQL subscriptions on the backend and frontend
import { ApolloClient } from 'apollo-client';
import { split } from 'apollo-link';
import { HttpLink } from 'apollo-link-http';
import { WebSocketLink } from 'apollo-link-ws';
import { getMainDefinition } from 'apollo-utilities';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { withClientState } from 'apollo-link-state';
import { ApolloLink, Observable } from 'apollo-link';
import { getUserFromLocalStorage } from './services/authService';
@JayBee007
JayBee007 / tutorial.md
Created July 26, 2018 18:39 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

render() {
const { title, description, styles, scripts, state, children } = this.props;
return (
<html className="no-js" lang="en">
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<title>{title}</title>
<meta name="description" content={description} />
<meta name="viewport" content="width=device-width, initial-scale=1" />
Session {
cookie:
{ path: '/',
_expires: null,
originalMaxAge: null,
httpOnly: true } }
* SET_RUNTIME_VARIABLE: { name: 'initialNow', value: 1498157281355 }
webpack: Compiling...
Child client:
Time: 787ms