Skip to content

Instantly share code, notes, and snippets.

Software Developer

Jose Tandavala tandavala

Software Developer
View GitHub Profile
View calculate_age_from_timestamp
const unix_timestamp = 610329600000;
const date = new Date(unix_timestamp);
const calculate_age = (dob) => {
const diff_ms = - dob.getTime();
const age_dt = new Date(diff_ms);
return Math.abs(age_dt.getUTCFullYear() - 1970);
View mongoose filtering list
employees.find( {{"age" : {$gt : 25}}, function(err, result){
View print3largestsNumber
function print3largest(array, size){
let i, first, second, third;
if(size < 3){
throw new Error("Invalid Input");
third = first = second = Number.MIN_VALUE;
for(i =0; i < size; i++){
// If current element is greater than frist
View mongoose findOneOrCreate solution
pageSchema.statics.findOneOrCreate = function findOneOrCreate(condition, doc, callback) {
const self = this;
self.findOne(condition, (err, result) => {
return result
? callback(err, result)
: self.create(doc, (err, result) => {
return callback(err, result);
tandavala /
Last active Oct 26, 2019
Como usar sass com node js


Sass é uma linguagem de script que é interpretada ou compilada em Cascading Style Sheets (CSS). e neste GIST estarei demonstrando como usar sass com node js.

Primeiro passo

Iniciar um projecto do zero com a framework express

mkdir node_sass
tandavala /
Last active Oct 19, 2019
Configurando Lektor com uma pagina do github e travis cs

Passo a passo para configurar o lektor com uma pagina do github e travis ci

Este passo a passo assume que já tenhas o lekto instalado caso contrario podes instalar o lektor seguindo a documentação neste link

tandavala / calc-rem.js
Created Jul 20, 2019 — forked from daniellmb/calc-rem.js
PX-to-REM Calculator
View calc-rem.js
(function($) {
var result = $('#result');
var base = $('#base');
var list = $('#list');
$('#calc').click(function() {
var baseVal = base.val();
var px = list.val().split(',');
var html = [];
$.each(px, function(i, v) {
var px = parseInt(v);
tandavala /
Created Jul 11, 2018 — forked from trandaison/
Get full version of StarUML




Source: jorgeancal

After installing StartUML successfully, modify LicenseManagerDomain.js as follow:

You can’t perform that action at this time.