Skip to content

Instantly share code, notes, and snippets.

Avatar

Hafiz Ismail sogko

View GitHub Profile
@sogko
sogko / app.js
Last active Oct 11, 2020
gulp + expressjs + nodemon + browser-sync
View app.js
'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
A useful terminal command using `go list` to list (non-standard) dependencies in your package directory
View go-list-deps.sh
go list -f '{{.Deps}}' | tr "[" " " | tr "]" " " | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
@sogko
sogko / main.go
Last active Sep 1, 2020
[graphql-go] Mutation example with `graphql-go/handler`
View main.go
package main
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/handler"
"net/http"
)
type Todo struct {
ID string `json:"id"`
View graphql_shorthand_notation_cheatsheet_overview.txt
// 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
View keybase.md

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 Jan 1, 2018
A pure ES6-style composable React component that handles clicks outside of a HTML node / React component. (No mixins)
View ClickOutsideListener.react.js
/*
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 Jan 21, 2017
Example of creating custom `graphql-go/handler` using `handler.NewRequestOptions()` to parse http.Requests
View main.go
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 Jan 20, 2017
[graphql-go] Mutation example
View main.go
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 Nov 11, 2016
hello-world-relay-part-2 - Schema definition (golang)
View schema.go
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 Aug 3, 2016
hello-world-graphql-part-1 - Server
View main.go
package main
import (
"net/http"
"github.com/graphql-go/graphql"
"github.com/graphql-go/graphql-go-handler"
)
var queryType = graphql.NewObject(graphql.ObjectConfig{
// ...
You can’t perform that action at this time.