Skip to content

Instantly share code, notes, and snippets.

Avatar

camilo montoya camilomontoyau

View GitHub Profile
View scope.js
const a = 1;
const b = 2;
const c = 3;
(function firstFunction() {
const b = 5;
const c = 6;
(function secondFunction() {
const b = 8;
(function thirdFunction() {
View async.js
const p = () => Promise.resolve(5);
const y = async () => {
const t = await p();
console.log(t);
};
y();
console.log('hello');
@camilomontoyau
camilomontoyau / test.js
Created Sep 11, 2020 — forked from getify/test.js
fun call-stack experiment
View test.js
function foo() {
baz();
}
function bar() {
baz();
}
function baz() {
console.log(`baz() was called from: ${whereWasICalledFrom()}`);
@camilomontoyau
camilomontoyau / index.js
Created May 1, 2020
ejemplo conexión mongo con mongoose y nodejs
View index.js
const mongoose = require('mongoose');
(async()=>{
await mongoose.connect('mongodb://nodeco-test-user:nodecotest1234@ds163822.mlab.com:63822/nodeco-test-01-mayo', {
useNewUrlParser: true,
useUnifiedTopology: true
});
})()
@camilomontoyau
camilomontoyau / useBreadcrumbEllipsis.js
Last active Apr 8, 2020
react hook for listening window resize event
View useBreadcrumbEllipsis.js
function useBreadcrumbEllipsis(crumbs, windowWidth) {
if(!crumbs.length) {
return [];
}
let _crumbs = _.cloneDeep(crumbs);
let processedCrumbs = [];
let totalCharactersSize = 0;
let pastTotalCharactersSize = 0;
let maxCharactersSize = 0;
switch(true) {
View scope.js
/* for (var i = 1; i <= 5; i++) {
(function() {
setTimeout(function timer() {
console.log(i);
}, i * 1000);
})();
} */
/* for (var i = 1; i <= 5; i++) {
(function() {
View daniel2.js
const getReview = async slug => {
try {
const userUid = await knex('user')
.where({
company_name: slug
})
.select('uid');
const userReviews = await axios.get(
`${url}/quotes/v1/reviews/?user=${user_uid}`,
View paso16.html
<html>
<body>
<div>
<div>PROP: <span>hola soy un texto estático</span></div>
<div>ESTADO: <span id="clicks">0</span></div>
<button id="boton">click acá</button>
</div>
<script type="text/javascript">
const clicksElement = document.getElementById('clicks');
const boton = document.getElementById('boton');
View paso15.html
<html>
<head>
<title>un título</title>
<meta charset="UTF-8" />
<style>
.letra-color-azul {
color: blue;
}
</style>
</head>
View paso14.html
<html>
<head>
<title>un título</title>
<meta charset="UTF-8" />
<style>
.letra-color-azul {
color: blue;
}
</style>
</head>