Skip to content

Instantly share code, notes, and snippets.

View sogko's full-sized avatar

Hafiz Ismail sogko

View GitHub Profile
@sogko
sogko / main.go
Last active August 3, 2016 07:37
hello-world-graphql-part-1 - Schema definition (golang)
package main
import (
"github.com/graphql-go/graphql"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.Fields{
"latestPost": &graphql.Field{
@sogko
sogko / database.go
Created October 14, 2015 11:00
hello-world-relay-part-1 - In-memory database
package data
// Data model structs
type Post struct {
Id string `json:"id"`
Text string `json:"text"`
}
// Mock data
var latestPost = &Post{
@sogko
sogko / main.go
Last active March 10, 2016 04:50
Example of using graphql-go/handler with a custom JWT middleware
package main
import (
"net/http"
"log"
"github.com/graphql-go/handler"
"github.com/graphql-go/relay/examples/starwars"
)
@sogko
sogko / schema.go
Last active February 11, 2016 05:59
package graphql
type Resources struct {
}
type Resource struct {
ID string `json:"id"`
Total float64 `json:"total"`
Used float64 `json:"used"`
When time.Time `json:"when"`
@sogko
sogko / SassMeister-input.scss
Created November 24, 2015 04:31
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
$viewportIncrement: 1px;
$small: 480px;
$postSmall: $small + $viewportIncrement;
.test {
width: $viewportIncrement;
@sogko
sogko / test.js
Created November 2, 2015 16:52
graphql-go #35
import {
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
GraphQLNonNull,
GraphQLList,
GraphQLBoolean,
GraphQLInt,
GraphQLFloat,
GraphQLEnumType,
@sogko
sogko / App.js
Last active October 14, 2015 14:53
hello-world-relay-part-1 - RelayJS App
import React from 'react';
import Relay from 'react-relay';
// Your React component
class App extends React.Component {
render() {
return (
<div>
<h1>{this.props.latestPost.text}</h1>
</div>
@sogko
sogko / AppHomeRoute.js
Last active October 14, 2015 14:21
hello-world-relay-part-1 - RelayJS App
import Relay from 'react-relay';
// Your Relay routes
// Define a root GraphQL query into which your
// containers' query fragments will be composed.
export default class extends Relay.Route {
static queries = {
latestPost: () => Relay.QL`
query {
latestPost
@sogko
sogko / file.go
Created October 14, 2015 13:56
hello-world-relay-part-1 - Update golang server
import (
...
"github.com/sogko/golang-relay-starter-kit/data"
)
...
@sogko
sogko / schema.graphql
Created October 14, 2015 10:18
hello-world-relay-part-1 - Schema definition (Shorthand notation)
//
// In GraphQL's type system shorthand notation.
// (See: http://graphql.org/docs/typesystem)
//
type Post {
id: ID!
text: String
}
type Query {
latestPost: Post