Skip to content

Instantly share code, notes, and snippets.

View shobhitchittora's full-sized avatar
🏠
Working from home

Shobhit Chittora shobhitchittora

🏠
Working from home
View GitHub Profile
@shobhitchittora
shobhitchittora / layout.html
Created November 23, 2015 10:10
HTML template for go
<!doctype html>
<html>
<body>
{{yield}}
<canvas id="myChart" width="400" height="400"></canvas>
</body>
@shobhitchittora
shobhitchittora / Chart.html
Created November 23, 2015 10:10
Chart template golang
<!doctype html>
<script src="Chart.min.js" type="text/javascript">
if(typeof Chart == 'undefined'){
console.log("ALERT");
alert("ALLLLL");
}
</script>
<center>
<table border="1px solid black">
@shobhitchittora
shobhitchittora / constructor.js
Last active April 15, 2018 12:50
JS Design Patterns - CONSTRUCTOR
// creating a new empty object
const a = new Object();
// defining a constructor
function User(id, name){
this.id = id;
this.name = name;
}
// creating a new object using the constructor
@shobhitchittora
shobhitchittora / module_object_literal.js
Last active April 15, 2018 13:59
JS Design Patterns - MODULE - Object Literal
const myModule = {
propertyA: "some value",
propertyB: function(){
console.log(this.propertyA);
}
};
console.log(myModule.propertyB()); // "some value"
@shobhitchittora
shobhitchittora / module_iife.js
Last active April 15, 2018 13:58
JS Design Patterns - MODULE - IIFE
// IIFE is an anonymous function which is called immediately.
const myModule = (function(){
// private
const name = "my module";
// public
return {
getName: function(){
console.log(name);
}
@shobhitchittora
shobhitchittora / module_iife_lodash.js
Last active April 15, 2018 13:58
JD Design Patterns - MODULE - IIFE - mixin
const myModule = (function(_){
var name = "MODULE";
return {
getName: function(){
console.log(_.capitalize(name));
}
};
})(_);
console.log(myModule.getName()); // "Module"
@shobhitchittora
shobhitchittora / person.proto
Created July 18, 2018 20:44
Protocol Buffers sample
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
@shobhitchittora
shobhitchittora / package.json
Last active July 22, 2018 11:08
initial project setup for gRPC tutorial
{
"name": "todo-app-grpc",
"version": "1.0.0",
"description": "A sample client and server to demonstrate use of gRPC with NodeJS.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start:server": "node src/server.js",
"start:client": "node src/client.js"
},
@shobhitchittora
shobhitchittora / todo.proto
Created July 22, 2018 11:22
Protocol Buffer file for Todo App gRPC
/**
* Author - Shobhit Chittora
*/
syntax = "proto3";
package todo_app_package;
service TodoApp {
rpc getTodo (TodoId) returns (Todo) {}
@shobhitchittora
shobhitchittora / todos_db.json
Created July 22, 2018 11:24
Todo App Json db
{
"todos": [
{
"id": 1,
"name": "Get eggs!",
"done": false
},
{
"id": 2,
"name": "Learn something new.",