Skip to content

Instantly share code, notes, and snippets.

View aluramh's full-sized avatar
🤠
Yee-haw!

Alejandro Ramírez aluramh

🤠
Yee-haw!
View GitHub Profile
# Insert an interval into a list of sorted disjoint intervals. This is a common interview question where the input is a sorted list of disjoint intervals, and your goal is to insert a new interval and merge all necessary intervals returning a final new list.
# For example, if the interval list is [[1,5], [10,15], [20,25]] and you need to insert the interval [12,27]
INPUT = [[1, 5], [10, 15], [20, 25]]
ADDITION = [0,1]
ANSWER = [[1, 5], [10, 27]]
def merge_intervals(interval_1, interval_2):
lower = min(interval_1[0], interval_2[0])
{
init(elevators, floors) {
function leastLoadedElevator() {
// Find elevator with lowest load factor
let elevatorIndex = 0;
let minLoad = 9999999;
elevators.forEach((elevator, index) => {
const currentLoad = elevator.loadFactor();
if (currentLoad < minLoad) {
minLoad = currentLoad;
// Given:
// - an array of points obtained for quests (points)
// - array of time to execute those quests (h)
// - time limit (timeForQuests)
// obtain the max score possible
// Sample input
// const h = [1, 4, 2];
// const points = [2, 3, 2];
// const timeForQuests = 4;

OceanFreightExchange

Front-end

  • Built an interactive web application from scratch using VueJS and SASS.
  • Built an interactive map that displayed current positions of over 72,000 vessels.
  • Built the Position List, the main functionality of the web application. This was done by creating the UI that allowed us to display all the results and the complete back-end for providing those results to display via an API.
  • Coordinated with a team across 3 different timezones to build updates to the UI and UX of the application.

Back-End

@aluramh
aluramh / sync.json
Last active December 4, 2019 17:51
SG
{
"log": ["*"],
"interface": "0.0.0.0:4984",
"adminInterface": "0.0.0.0:4985",
"databases": {
"db": {
"server": "http://34.70.57.5:8091",
"num_index_replicas": 0,
"use_views": false,
"bucket": "card_bucket",
@aluramh
aluramh / logs.txt
Created October 1, 2019 18:03
App to foreground
3) Rev: 100. Output:
```
019-10-01 12:58:04.664444-0500 Register[22626:349291] CouchbaseLite Replicator Info: {Puller#11} activityLevel=stopped: pendingResponseCount=0, _caughtUp=1, _pendingRevMessages=0, _activeIncomingRevs=0
2019-10-01 12:59:54.967529-0500 Register[22626:349121] CouchbaseLite Replicator Info: {Pusher#12} activityLevel=stopped: pendingResponseCount=0, caughtUp=1, changeLists=0, revsInFlight=0, blobsInFlight=0, awaitingReply=0, revsToSend=0, pushingDocs=0, pendingSequences=0
2019-10-01 12:59:54.967737-0500 Register[22626:349282] CouchbaseLite Replicator Info: CBLReplicator[<*> URL[ws://ec2-13-56-209-220.us-west-1.compute.amazonaws.com:4984/users/]] is offline, progress 0/0, error: (null)
2019-10-01 12:59:54.968165-0500 Register[22626:347918] CouchbaseLite Replicator Info: CBLReplicator[<*> URL[ws://ec2-13-56-209-220.us-west-1.compute.amazonaws.com:4984/users/]]: Set suspended = 0 (state = 2, status = 1)
2019-10-01 12:59:54.968355-0500 Register[22626:347918] CouchbaseLite Replicator Info: CBL
@aluramh
aluramh / scraper.js
Last active March 24, 2018 00:19
Reads results.json and sends a POST request for each row to be saved to the DB.
const axios = require('axios');
const fs = require("fs");
const promisesArray = [];
(async function main () {
try {
// Read data dump
let scraperOutput = JSON.parse(fs.readFileSync('./input/results.json', 'utf8'));