Skip to content

Instantly share code, notes, and snippets.

View sogko's full-sized avatar

Hafiz Ismail sogko

View GitHub Profile
@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 / 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 / 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 / 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 / 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 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 / main.go
Last active August 3, 2016 07:39
hello-world-graphql-part-1 - Server
package main
import (
"net/http"
"github.com/graphql-go/graphql"
"github.com/graphql-go/graphql-go-handler"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
// ...
@sogko
sogko / schema.go
Last active November 11, 2016 08:59
hello-world-relay-part-2 - Schema definition (golang)
package data
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/relay"
)
var postType *graphql.Object
var queryType *graphql.Object
var Schema graphql.Schema
@sogko
sogko / main.go
Last active January 20, 2017 06:08
[graphql-go] Mutation example
package main
import (
"github.com/graphql-go/graphql"
"github.com/kr/pretty"
)
type Todo struct {
ID string `json:"id"`
Text string `json:"text"`
@sogko
sogko / main.go
Last active January 21, 2017 20:01
Example of creating custom `graphql-go/handler` using `handler.NewRequestOptions()` to parse http.Requests
package main
import (
"encoding/json"
"net/http"
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
"github.com/graphql-go/relay/examples/starwars"
)