Skip to content

Instantly share code, notes, and snippets.

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

Alexander Escamilla alexesca

🏠
Working from home
View GitHub Profile
var a = {
sayHello(){
console.log("hello")
}
}
var b = {
sayHello: function(){
console.log("hello")
}
// Before ECMAScript 2015
const obj = {
foo: function() {
// ...
},
bar: function() {
// ...
}
}
/** Taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions*/
function Person() {
// The Person() constructor defines `this` as an instance of itself.
this.age = 0;
setInterval(function growUp() {
// In non-strict mode, the growUp() function defines `this`
// as the global object (because it's where growUp() is executed.),
// which is different from the `this`
export class MyClass {
constructor(private myVariable: string) {}
getMyVariable() {
return this.myVariable;
}
}
export class MyClass {
static add(num1, num2) {
return num1 + num2;
}
subtract(num1, num2) {
return num1 - num2;
}
}
/* Stack the shows the progression of the LIFO thinking */
console.clear()
const array = [];
console.log("Initial array ",array)
console.log("Push 1: ", array.push(1))
console.log("Push 2: ", array.push(2))
console.log("Push 3: ", array.push(3))
console.log("Array ", array)
console.log("Pop 1: ", array.pop())
const observable = events => {
const INTERVAL = 1 * 1000;
let schedulerId;
return {
subscribe: observer => {
schedulerId = setInterval(() => {
if(events.length === 0) {
observer.complete();
clearInterval(schedulerId);
@alexesca
alexesca / docker-compose.yml
Created November 25, 2020 21:12
How to add mongo
mongo:
image: mongo:latest
container_name: mongoAWS
hostname: mongodbAWS
volumes:
- ./.docker/mongodb/mongod.conf:/etc/mongod.conf
- ./.docker/mongodb/initdb.d/:/docker-entrypoint-initdb.d/
- ./.docker/mongodb/data/db/:/data/db/
- ./.docker/mongodb/data/log/:/var/log/mongodb/
env_file:
version: [docker_compose_version]
services:
contractor-web-app:
image: "[username]/[dockerhub_image_name]"
ports:
- "[host_port]:[container_port]"
env_file:
- [path_to_.env_file]