Skip to content

Instantly share code, notes, and snippets.

View flpms's full-sized avatar

Filipe M. Silva flpms

View GitHub Profile
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Person = function () {
function Person(firstName, lastName) {
_classCallCheck(this, Person);
"use strict";
var Person = (function () {
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.firstName = firstName;
this.lastName = lastName;
}
;
Object.defineProperty(Person.prototype, "fullName", {
@flpms
flpms / regex-example.js
Last active November 7, 2017 19:04
Regular expression problems
let regex = /country\,/gi;
console.log(regex.source) // country\, (In nodejs is country\\,)
regex.source == ‘country\,’; //false
regex.source === ‘country\,’; //false
let a = new RegExp(/country\,/, 'gi');
console.log(a.source);
a.source === 'country\,' // false
a.source == 'country\,' // false
@flpms
flpms / script-index.js
Last active October 7, 2019 17:03
Meu código antigo escrito em 2009
// JavaScript Document
window.onload = function(){
navigatorUsed = navigator.appName;
URL = new Array();
URL[0] = "services.xml";
tags = new Array();
tags[0] = "li";
tags[1] = "p";
function soma(numeros) {
let totalSoma = 0;
let i;
for (i = 0; i < numeros.length; i++) {
totalSoma += numeros[i];
}
return totalSoma;
}
function divisao(numero, dividendo) {
return numero/dividendo;
}
class OperacoesBasicas {
soma(numeros) {
let i;
let totalSoma = 0;
for (i = 0; i < numeros.length; i++) {
totalSoma += numeros[i];
}
return totalSoma;
const saveOrderWrapper = (dependencies) => {
const { repository, config } = dependencies;
const { mongoDB } = repository;
const { orderTTLInDays } = config.app;
const orderTTL = (millesecondsInADay * orderTTLInDays);
const asyncCall = prepareCall(dependencies);
@flpms
flpms / jwtRS256.sh
Created May 5, 2020 18:00 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub