Skip to content

Instantly share code, notes, and snippets.

View himanshu-dixit's full-sized avatar
🦖
Focusing

Himanshu Dixit himanshu-dixit

🦖
Focusing
View GitHub Profile
@himanshu-dixit
himanshu-dixit / add_two_number_leetcode.cpp
Created February 2, 2019 12:53
add_two_number_leetcode.cpp
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
package main
import (
"fmt"
)
type doublyLinkedNode struct {
prev, next * doublyLinkedNode
key, val int
}
....
class Dashboard extends Component {
....
logout() {
let auth = new Auth();
auth.logout();
}
render() {
import React, {Component} from 'react';
import {Mutation} from 'react-apollo';
import {updateTodo, getTodos} from '../../Queries';
class UpdateToDo extends Component {
constructor(props) {
super(props);
this.state = {
id: this.props.todo_id
}
import React, { Component } from 'react';
import {Mutation} from 'react-apollo';
import {deleteTodo, getTodos} from '../../Queries';
class DeleteTodos extends Component {
constructor(props) {
super(props);
this.state = {
id: this.props.todo_id
}
import React, { Component } from 'react';
import {Mutation} from 'react-apollo';
import {addTodo, getTodos} from '../../Queries';
class AddTodos extends Component {
constructor(props) {
super(props);
this.state = {
task: "",
user: localStorage.getItem("user"),
import React, { Component } from 'react';
import { Query} from 'react-apollo';
import {getTodos} from '../../Queries';
import DeleteTodos from "./DeleteTodos";
import UpdateToDo from "./UpdateToDo";
class ListAllTodos extends Component {
render() {
return (
...
constructor(props) {
super(props);
const ACCESS_TOKEN = localStorage.getItem('access_token');
this.client = new ApolloClient({
uri: "https://himanshu-todo.herokuapp.com/v1alpha1/graphql",
headers: {
'Authorization': `Bearer ${ACCESS_TOKEN}`,
}
});
import gql from 'graphql-tag';
export const getTodos = gql`{
todo(order_by: []){
id
task
user
completed
}
}`;
import React, { Component } from 'react';
...
class App extends Component {
render() {
const handleAuthentication = (nextState, replace) => {
if (/access_token|id_token|error/.test(nextState.location.hash)) {
const auth = new Auth();
auth.handleAuthentication();
}