Skip to content

Instantly share code, notes, and snippets.

Avatar

Rodrigo Cisternas Albornoz rodcisal

  • Paris
View GitHub Profile
@rodcisal
rodcisal / getPairs.ts
Created May 2, 2021
Get Pairs that makes target number
View getPairs.ts
function getPairs (array: number[], target: number): number {
const needed = {};
let result = 0;
for (let i = 0; i < array.length; i++) {
// store pair that makes target with element from original array and index
needed[array[i] - target] = i;
}
for (let i = 0; i < array.length; i++) {
View maxProfit.js
// const testArr = [1,6,1,6,9];
const t1 = [1,5,0,6,7,10,10,12,7,7,7,8,7];
const t2 = [1,2,3,4];
function closestMaxInArray(arr) {
let maxIdx = 0;
let minIdx = 0;
for (let idx in arr) {
const val = arr[idx];
View SH-request
```(echo -n '{"user":"victorbaez@docmovi.com", "userFirstName": "Victor", "userLastName": "Baez", "profileId": "30383539-7172-7a69-5765-04566b374b30", "profileFirstName": "Margarita", "profileLastName": "Vengas azocar", "ecgId": "TESTING_ID", "ecgDateTime": "Tue Mar 09 2021 15:56:46 GMT+0100 (Central European Standard Time)", "reference": "TESTING_REFERREENCE", "deviceSN": "TESTING_DEVICE_SN", "reports": [{ "type": "ecg-pdf", "data": "'; base64 /Users/rodrigocisternas/Desktop/ecgCK.pdf; echo '"}]}') | curl -H "Content-Type: application/json" -d @- http://localhost:3000/api/ecg```
Where ecgCK.pdf is a report downloaded using the API
View HooksAndDestructuring.js
const useNameAndLastName = () => {
return {
name: 'Rodrigo',
lastName: 'Cisternas',
}
}
// const ln = useNameAndLastName();
const name = useNameAndLastName().name;
const lastName = useNameAndLastName().lastName;
View PadresEHijos.js
import React from 'react';
const hijos = [
{
nombre: 'Leonardo',
edad: 33
},
{
nombre: 'Rodrigo',
edad: 32
View generateDocuments.js
import { Email } from "meteor/email";
import axios from "axios";
import PDFDocument from "pdfkit";
import logoImage from "./logoImage";
import pushPdfToS3 from "./pushPdfToS3";
import UserFiles from "../collections/Files";
import formatRut from "../../../lib/formatRut";
import { renderFirma, renderFooter } from "./pdfs";
import { regularFontPath, boldFontPath } from "./pdfs/fonts";
View especialidadesMedicas.json
[
{
"nombre": ""
},
{
"_id": "B01",
"_rev": "8-c287cf406c6a1c55a3ac62cbf467c44e",
"estado": "",
"prestaciones": [
{
View post-example.js
import { Meteor } from "meteor/meteor";
import { Random } from "meteor/random";
import { Atenciones } from "../collections/atencion";
if (Meteor.isServer) {
const Api = new Restivus({
useDefaultAuth: false,
prettyJson: true
});
View videocall.js
import React, { useRef, useLayoutEffect } from 'react'
import PropTypes from 'prop-types'
import './Videollamada.scss'
import DailyIframe from '@daily-co/daily-js'
function Videocall ({ toggleCall, conversationId, callActive }) {
const callRef = useRef()
if (callRef.current && !callActive) {
callRef.current.leave()
View medicamentos.json
[
{
"nombre": "AB",
"laboratorio": "SAVAL"
},
{
"nombre": "AB ANTITUSIVO",
"laboratorio": "SAVAL"
},
{