Skip to content

Instantly share code, notes, and snippets.

@Dajust
Dajust / index.js
Created October 30, 2021 10:09
Apollo GraphQL Subscription issues
import { createServer } from 'http';
import { execute, subscribe } from 'graphql';
import { SubscriptionServer } from 'subscriptions-transport-ws';
import { makeExecutableSchema } from '@graphql-tools/schema';
import express from 'express';
import { ApolloServer } from 'apollo-server-express';
import { gql } from 'apollo-server-core';
import { PubSub } from 'graphql-subscriptions';
@Dajust
Dajust / LIKE.JS
Last active October 11, 2017 04:51
import React, { Component } from "react";
import { PropTypes } from "prop-types";
import { postData, getLikeBusinessEndpoint } from "../../utils/";
import CheckAuth from "../checkAuth/CheckAuth";
class LikeBusinessButton extends Component {
state = {
isLiked: this.props.isLiked
};
@Dajust
Dajust / Like.js
Last active October 11, 2017 04:46
import React, { Component } from "react";
import { PropTypes } from "prop-types";
import { postData, getLikeBusinessEndpoint } from "../../utils/";
import CheckAuth from "../checkAuth/CheckAuth";
class LikeBusinessButton extends Component {
state = {
isLiked: this.props.isLiked
};
// Description:
// This simple component is from a production code I'm currently working on.
// It is for triggering the loading of more contents from the server.
// Once the data arive from server, hand it over to the parent component that needs the data
//
// Note: This gits doesn't use the functional setState pattern, for the sake of brevity.
import React, { Component } from "react";
class LoadMore extends Component {
@Dajust
Dajust / gist:65cac387de855a8090f6
Created November 26, 2015 12:48
http://www.freecodecamp.com/dajust 's solution for Bonfire: Roman Numeral Converter
// Bonfire: Roman Numeral Converter
// Author: @dajust
// Challenge: http://www.freecodecamp.com/challenges/bonfire-roman-numeral-converter?solution=var%20romanNumeralMap%20%3D%20%7B%0A%20%200%20%20%20%20%3A%20%27%27%2C%20%0A%20%201%20%20%20%20%3A%20%27I%27%2C%20%0A%20%202%20%20%20%20%3A%20%27II%27%2C%20%0A%20%203%20%20%20%20%3A%20%27III%27%2C%20%0A%20%204%20%20%20%20%3A%20%27IV%27%2C%20%0A%20%205%20%20%20%20%3A%20%27V%27%2C%0A%20%206%20%20%20%20%3A%20%27VI%27%2C%0A%20%207%20%20%20%20%3A%20%27VII%27%2C%0A%20%208%20%20%20%20%3A%20%27VIII%27%2C%0A%20%209%20%20%20%20%3A%20%27IX%27%2C%0A%20%2010%20%20%20%3A%20%27X%27%2C%0A%20%2020%20%20%20%3A%20%27XX%27%2C%0A%20%2030%20%20%20%3A%20%27XXX%27%2C%0A%20%2040%20%20%20%3A%20%27XL%27%2C%0A%20%2050%20%20%20%3A%20%27L%27%2C%0A%20%2060%20%20%20%3A%20%27LX%27%2C%0A%20%2070%20%20%20%3A%20%27LXX%27%2C%0A%20%2080%20%20%20%3A%20%27LXXX%27%2C%0A%20%2090%20%20%20%3A%20%27XC%27%2C%0A%20%20100%20%20%3A%20%27C%27%2C%0A%20%20200%20%20%3A%20%27CC%27%2C%0A%20%20300%20%20%3A%20%27CCC%27