Skip to content

Instantly share code, notes, and snippets.

Avatar

Johan Eliasson elitan

View GitHub Profile
View react-apollo-hasura-with-subscriptions.js
import React, { Component } from 'react';
import { Redirect } from 'react-router-dom';
import { ApolloProvider } from 'react-apollo';
import { InMemoryCache } from 'apollo-cache-inmemory';
import ApolloClient from 'apollo-client';
import { setContext } from 'apollo-link-context';
import { WebSocketLink } from 'apollo-link-ws';
import { HttpLink } from 'apollo-link-http';
import { split } from 'apollo-link';
@elitan
elitan / gist:71b82bd809df81f34a9a778807782437
Created Dec 29, 2017
Ubuntu Bose QC35 bluetooth problem
View gist:71b82bd809df81f34a9a778807782437
> cat /etc/bluetooth/main.conf
ControllerMode = bredr
Disable=Headset
AutoConnect=true
Also:
https://askubuntu.com/questions/689281/pulseaudio-can-not-load-bluetooth-module-15-10-16-04-16-10
@elitan
elitan / ContactForm.js
Last active Jul 28, 2020
React Router V4 Redirect after form submission
View ContactForm.js
import React, { Component } from 'react';
import { withRouter } from 'react-router-dom'; // <--- import `withRouter`. We will use this in the bottom of our file.
class ContactForm extends Component {
submitForm (e) {
e.preventDefault()
this.props.history.push('/thank-you'); // <--- The page you want to redirect your user to.
}
View timeElapsedString.php
function timeElapsedString($ptime)
{
$etime = time() - $ptime;
if ($etime < 1)
{
return '0 seconds';
}
$a = array( 12 * 30 * 24 * 60 * 60 => 'år,år',
You can’t perform that action at this time.