Skip to content

Instantly share code, notes, and snippets.

🔥
Developing Platforms

Prosper Otemuyiwa unicodeveloper

🔥
Developing Platforms
Block or report user

Report or block unicodeveloper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View post-from-fibre-to-eden.js
import 'dotenv/config';
import express from 'express';
import axios from 'axios';
import cors from 'cors';
import crypto from 'crypto';
const app = express();
app.use(cors());
app.use(express.json());
View post-from-fibre-to-eden.php
<?php
$payload = [
'event' => 'customer.created',
'data' => [
'full_name' => 'Mark Fish',
'email' => 'takeit@chairman.com'
]
];
View individualcomponents.js
const User = ({ id, children }) => {
<Query query={GET_USER} variables={{ userId }}>
{({ loading, data }) => (children({ user: data}))
</Query>
}
const UserStartup = ({ user: { email }, children }) => (
<Query query={GET_HACKERNEWS_STARTUP} variables={{ email }}>
{({ loading, data: { startup } }) => (
<Query query={GET_REPO} variables = {{ startup }}>
View refactored.js
<User id={id}>
{({ user }) => (
<UserStartup user={user}>
{
({ data: { startup, startup: { correspondingRepo: repo }}}) =>
<UI repo={repo} email={user.email} startup={startup}/>
}
</UserStartup>
)}
</User>
View getandshowdata.js
export const GetAndShowData = ({ userId }) => (
<Query query={GET_USER} variables={{ userId }}>
{({ loading, data: { email } }) => (
<Query query={GET_HACKERNEWS_STARTUP} variables={{ email }}>
{({ loading, data: { startup } }) => (
<Query query={GET_REPO} variables = {{ startup }}>
{({loading, error, data: { correspondingRepo } }) => {
if (loading) return <p>Loading...</p>;
if (error) return <p>Error...</p>;
return (
View loadinganderror.js
const GetPosts = () => (
<Query query={GET_POSTS}>
{({ loading, error, data }) => {
if (loading) return "Loading...";
if (error) return "Error";
return (
<div>
{data.posts.map(post => (
<p key={post.id}> { post.title } </p>
))}
View fetchmore.js
const FeedData = ({ match }) => (
<Query
query={FEED_QUERY}
variables={{
type: match.params.type.toUpperCase() || "TOP",
offset: 0,
limit: 10
}}
fetchPolicy="cache-and-network"
>
View polling.js
const DogPhoto = ({ breed }) => (
<Query
query={GET_DOG_PHOTO}
variables={{ breed }}
skip={!breed}
pollInterval={500}
notifyOnNetworkStatusChange
>
{({ loading, error, data, networkStatus }) => {
if (networkStatus == 6) return "Polling for data..Stay tuned!";
View refetching.js
export const GetACar = () => (
<Query query={GET_A_CAR} notifyOnNetworkStatusChange>
{({ loading, error, data, refetch, networkStatus }) => {
if (networkStatus === 4) return "Refetching...";
if (loading) return <p>Loading...</p>;
if (error) return <p>Error...</p>;
return (
<div>
<p> Color: {data.car.color} </p>
You can’t perform that action at this time.