Skip to content

Instantly share code, notes, and snippets.

View rxluz's full-sized avatar

Ricardo Luz rxluz

View GitHub Profile
// 1. Get all candidates by job id
// GET https://harvest.greenhouse.io/v1/candidates?job_id=87752
{
[
"name": 'Selena',
"applications": [
{ "id": 69103370,
"jobs": [
{
"id": 87752,
const tests = {
valid: '{[(())]}',
valid2: '{}',
valid3: '()',
valid4: '[]',
valid5: '{[]}',
valid6: '{[()]}',
valid7: '',
valid8: '[]{}[][]()()',
invalid0: '[{}]',
@rxluz
rxluz / deepFreeze.js
Last active April 22, 2020 16:22
The problem with Object.freeze, see more at: https://medium.com/p/1a258c160c07
function deepFreeze(obj) {
Object.freeze(obj)
const propertiesList = Object.getOwnPropertyNames(obj)
propertiesList.forEach((key) => {
const isNotNullOrUndefined =
obj[key] !== null || typeof obj[key] !== 'undefined'
const hasOwnProperty = obj.hasOwnProperty(key)
async function run() {
var test = {
value: 0,
};
const testss = await new Promise(accept =>
setTimeout(() => ((test.value = 90), console.log(test.value), accept()), 0),
);
{
"categoriesSelection": [
{
"category": {
"id": 30,
"name": "234234aefdsfdsfdsf",
"description": null,
"products_total": 4
},
"productsExclusionList": []
@rxluz
rxluz / DATA_STRUCTURES_BSTImplementation.js
Last active February 5, 2019 12:47
JS Data Structures: Trees, see more at: https://medium.com/p/5dee18f68982
function BST() {
let root = null
class Utils {
static node(key) {
return { key, left: null, right: null }
}
static insertNode(node, key) {
if (!node) {
@rxluz
rxluz / DATA_STRUCTURES_hashTableSeparateChaining.js
Created January 31, 2019 10:38
JS Data Structures: Hash tables, see more at: https://medium.com/p/e3c229ecaacb
function LinkedList() {
let head = null
let size = 0
class Utils {
static node(element) {
return {
element,
next: null,
}
@rxluz
rxluz / DATA_STRUCTURES_hashTableWithLinearProbing.js
Last active January 31, 2019 10:37
JS Data Structures: Hash tables, see more at: https://medium.com/p/e3c229ecaacb
function HashTable() {
let table = []
let size = 0
class Utils {
static djb2(key) {
let hash = 5381
const keyChars = key.split('')
@rxluz
rxluz / DATA_STRUCTURES_dictionaryExample.js
Created January 30, 2019 02:12
JS Data Structures: Dictionaries/maps, see more at: https://medium.com/p/5c059d7b9e82
function Map() {
let items = {}
let size = 0
class PublicMap {
has(key) {
return key in items
}
set(key, value) {
const animals = ['elephant', 'monkey', 'snake', 'lion']
const desiredPositionToRemove = 2
for (var index = desiredPositionToRemove; index < animals.length; index++) {
animals[index] = animals[index + 1]
}
animals.length = animals.length - 1