Skip to content

Instantly share code, notes, and snippets.

Hafiz Ismail sogko

Block or report user

Report or block sogko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sogko
sogko / log.js
Last active Aug 29, 2015
NodeJS datetimestamp-ed logger
View log.js
/**
* NodeJS logger with datetime stamp just because.
* ===============================================
*
* Hold onto your socks now.
*
* Usage example
* var logger = new (require('./logger'))().log;
* var prefixedLogger = new (require('./logger'))('[PREFIX]').log;
*
View ArangoDB_issue_973_01.js
var Arango = require('arangojs');
var async = require('async');
var db = Arango.Connection();
var testDate = 1406881769977; // Fri Aug 01 2014 08:29:29 GMT+0000
var dateDelta = 500000;
var data = [];
var edgesData = [];
var createdDocuments = [];
View ArangoDB_issue_973_02.js
var Arango = require('arangojs');
var async = require('async');
var db = Arango.Connection();
var testDate = 1406881769977; // Fri Aug 01 2014 16:29:29 GMT+0800 (SGT)
var dateDelta = 500000;
var data = [];
var edgesData = [];
var createdDocuments = [];
@sogko
sogko / app.js
Last active Jan 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 / 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 / schema.graphql
Last active Oct 7, 2015
hello-world-graphql-part-1 - Schema definition (Shorthand notation)
View schema.graphql
//
// In GraphQL's type system shorthand notation.
// (See: http://graphql.org/docs/typesystem)
//
type Query {
latestPost: String
}
@sogko
sogko / main.go
Last active Aug 3, 2016
hello-world-graphql-part-1 - Schema definition (golang)
View main.go
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 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{
// ...
@sogko
sogko / response.json
Created Oct 7, 2015
hello-world-graphql-part-1 - Expected response
View response.json
{
"data": {
"latestPost": "Hello World!"
}
}
You can’t perform that action at this time.