Skip to content

Instantly share code, notes, and snippets.

View sogko's full-sized avatar

Hafiz Ismail sogko

View GitHub Profile
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@sogko
sogko / go-list-deps.sh
Created May 1, 2015 11:43
A useful terminal command using `go list` to list (non-standard) dependencies in your package directory
go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
@sogko
sogko / main.go
Last active November 16, 2020 03:51
[graphql-go] Mutation example with `graphql-go/handler`
package main
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
"net/http"
)
type Todo struct {
ID string `json:"id"`
// GraphQL Shorthand Notation Cheatsheet
// - Read the full article at: https://wehavefaces.net/graphql-shorthand-notation-cheatsheet-17cd715861b6
Schema
=======
GraphQL Schema => schema
Built-in scalar types

Keybase proof

I hereby claim:

  • I am sogko on github.
  • I am sogko (https://keybase.io/sogko) on keybase.
  • I have a public key ASD0R6VsTfZSI37_2wKvxjFy4ES_Qltu2-sJRunyNzzA-Qo

To claim this, I am signing this object:

@sogko
sogko / ClickOutsideListener.react.js
Last active January 1, 2018 13:14
A pure ES6-style composable React component that handles clicks outside of a HTML node / React component. (No mixins)
/*
A pure ES6-style composable React component that handles clicks outside of a HTML node.
This is for those who prefers composibility over mixins.
Simply drop-in the event listener component into your React component.
Adapted from: https://github.com/Pomax/react-onclickoutside
*/
var React = require('react');
@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"
)
@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 / 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 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{
// ...