Skip to content

Instantly share code, notes, and snippets.

Avatar

Hafiz Ismail sogko

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 / 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 / response.json
Created Oct 7, 2015
hello-world-graphql-part-1 - Expected response
View response.json
{
"data": {
"latestPost": "Hello World!"
}
}
@sogko
sogko / curl.sh
Last active Oct 12, 2015
hello-world-graphql-part-1 - Curl command
View curl.sh
curl -XPOST http://localhost:8080/graphql \
-H 'Content-Type: application/graphql' \
-d 'query Root{ latestPost }'
@sogko
sogko / schema.graphql
Created Oct 14, 2015
hello-world-relay-part-1 - Schema definition (Shorthand notation)
View schema.graphql
//
// In GraphQL's type system shorthand notation.
// (See: http://graphql.org/docs/typesystem)
//
type Post {
id: ID!
text: String
}
type Query {
latestPost: Post
@sogko
sogko / file.go
Created Oct 14, 2015
hello-world-relay-part-1 - Update golang server
View file.go
import (
...
"github.com/sogko/golang-relay-starter-kit/data"
)
...
@sogko
sogko / AppHomeRoute.js
Last active Oct 14, 2015
hello-world-relay-part-1 - RelayJS App
View AppHomeRoute.js
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 / App.js
Last active Oct 14, 2015
hello-world-relay-part-1 - RelayJS App
View App.js
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>
You can’t perform that action at this time.