Skip to content

Instantly share code, notes, and snippets.

View aquiseb's full-sized avatar

Sébastien aquiseb

View GitHub Profile
@aquiseb
aquiseb / Go_Context.go
Last active September 12, 2022 19:54
Golang context package examples
package main
import (
"bufio"
"context"
"fmt"
"log"
"os"
"time"
)
import React from 'react';
class Cat extends React.Component {
render() {
const mouseposition = this.props.mouseposition;
return (
<img src="https://dummyimage.com/30x30/000/fff" style={{ position: 'absolute', left: mouseposition.x -30, top: mouseposition.y -30 }} />
);
}
}
@aquiseb
aquiseb / React.16.3_Context.js
Last active April 28, 2018 19:15
React 16.3 Context example
import React, { Component } from "react";
import { render } from "react-dom";
const PostContext = React.createContext();
class PostProvider extends Component {
state = {
review: "bad"
};
render() {
/* eslint-disable */
import React from 'react';
import PropTypes from 'prop-types';
class App extends React.Component {
static displayName = `App`;
static propTypes = {
// eslint-disable-next-line react/forbid-prop-types
children: PropTypes.node.isRequired
@aquiseb
aquiseb / MyComponent.jsx
Last active April 28, 2018 19:16
Reactjs Nextjs HOC
import React from 'react'
import { Enhance } from "../components/Enhance";
class MyComponent extends React.Component {
render() {
if (!this.props.data) return <div>Waiting...</div>;
return <div>{this.props.data}</div>;
}
}
@aquiseb
aquiseb / graphql-go-mongodb-example.go
Last active March 16, 2026 12:11
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/graph-gophers/graphql-go"
@aquiseb
aquiseb / react-vr-get-current-angle-of-view.js
Last active February 27, 2018 00:01
Get current angle of view in React VR
// Some explanation here https://medium.com/p/a928ca90f489
import React from 'react';
import { AppRegistry, asset, Pano, Text, View, VrHeadModel } from 'react-vr';
const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
class WelcomeToVR extends React.Component {
constructor(props) {
super(props);
this.state = {