Skip to content

Instantly share code, notes, and snippets.

View cjus's full-sized avatar
🤓

Carlos Justiniano cjus

🤓
View GitHub Profile
@cjus
cjus / playing-with-es6.md
Last active October 20, 2015 11:12
Playing with ES6

A few words about this presentation

ECMAScript is a scripting language specification and standard from which JavaScript, JScript and ActionScript are popular implementations. ECMAScript version 5.1 (ES5) is the current version used in JavaScript implementations found in modern web browsers. In this presentation we'll refer to ES5 as the current version of JavaScript and ES6 as the newer version.

There are over one hundred new features in ES6. This presentation focuses, instead, on helping to prepare you to write, build and test ES6 code. Along the way we'll definitely look at actual code samples

I've also choosen to present ES6 features which are relatively easy to grasp so that your onramp to ES6 isn't unnecessarily complicated. As you gain experience with ES6 you'll learn about more complex features. Remember that the power of any language is realized in how the features come together to become much more than the sum of their parts. So definitely take the time to learn as many of the new features as

@cjus
cjus / geolatlnglib
Created November 9, 2015 19:02
Utility for lat lng calculations
/**
* @name geolatlnglib
* @description utilities for lat lng calculations
* @author Carlos Justiniano
*/
//http://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points
function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
'use strict';
var R = 6371; // Radius of the earth in km
@cjus
cjus / semicolon.md
Created February 15, 2016 17:23
At semi-colon to line in Atom

While working in Javascipt we need to quickly append semi-colons to most lines. These settings modify Atom to map command-; to add a semi-colon to the end of the current line.

In init.coffee:

atom.commands.add 'atom-text-editor', 'custom:semicolonize', ->
  editor = @getModel()
  editor.moveToEndOfLine()
 editor.insertText(';')
@cjus
cjus / microservices-and-databases.md
Last active April 6, 2016 10:11
Microservices and databases

Microservices and databases

Some thoughts on Microservices and databases

One of the recommended best practices for microservices is that each service have its own database - when practical. The goal is to reduce the potential impact that a single database migration change might have across a collection of services. Think of a relational database change, which isn't schema-less by nature, and how each depending service might be impacted prior to a production release. In complex systems identifying impact across subsystems becomes a project in and of itself.

By ensuring that each microservices has its own database, the impact of change may be isolated or at least kept at bay.

However, this does raise an import question and opportunity. At the level of a microservices, what is the right database to use? The reason this question is also an opportunity is because we can think about database requirements in the context of a what an ind

Notes while learning Docker

These notes are derived from my efforts in working through The Docker Book: Containerization is the new virtualization written by James Turnbull. I highly recommend getting a copy of Jame's book which is an $8 dollar e-book on Amazon.

The following notes are my own and simply an interpretation of what James has written. Caveat lector.

Ensuring Docker is ready

$ docker info
@cjus
cjus / Deployment-instructions.md
Created July 5, 2016 16:56
Deployment instructions

Deployment instructions

Push the project to a machine, then:

$ npm install

Make sure you have Node NSP installed.

@cjus
cjus / nodejs-project-backup.md
Last active January 2, 2021 16:58
NodeJS project backup script

NodeJS project backup script

The following shell script backups up the currrent node project by performing the following actions:

  • Assumes that the back script is bundled with the actual NodeJS projecxt foler.
  • Uses the current directory as the backup file name.
  • Moves to the parent folder to create a tarball using the project name and the current date stamp and excludes the node_modules folder.
  • Lists the backups created using the script.
@cjus
cjus / `Hydra-workshop.md
Last active December 15, 2016 15:25
Hydra workshop files
@cjus
cjus / node-interfaces.md
Last active August 10, 2017 12:09
Show available network interfaces in a Node JS app
const os = require('os');
let interfaces = os.networkInterfaces();
Object.keys(interfaces).
  forEach((interface) => {
    interfaces[interface].forEach((interfaceRecord)=>{
      if (interfaceRecord.family === 'IPv4') {
        console.log(`${interface}: ${interfaceRecord.address}`);
 }
@cjus
cjus / config.json
Last active February 19, 2018 04:00
Hydra getServicePresence example
{
"hydra": {
"serviceName": "caller",
"serviceDescription": "",
"serviceIP": "",
"servicePort": 0,
"serviceType": "",
"redis": {
"url": "redis://localhost:6379/15"
}