Skip to content

Instantly share code, notes, and snippets.

View juanandresnyc's full-sized avatar
🎯
Focusing

Juan Andres Andrango juanandresnyc

🎯
Focusing
View GitHub Profile
@juanandresnyc
juanandresnyc / probe_endpoints.py
Created December 13, 2019 20:29
probes patient medication endpoints for latency and size responses
import requests
import json
URL_BASE = {
'local': 'http://localhost:8000',
'staging': 'https://api.staging.internal.capsulerx.com'
}
CREDENTIALS = {
'local': ('jandrango@capsulecares.com', 'hellodear'),
SELECT
"capsule_core_patientmedication"."id", "capsule_core_patientmedication"."should_process_refill", "capsule_core_patientmedication"."standard_fill_size", "capsule_core_patientmedication"."next_refill_date", "capsule_core_patientmedication"."medication_id", "capsule_core_medication"."primary_name", "capsule_core_medication"."secondary_name", "capsule_core_medication"."control_schedule", "capsule_core_medication"."mixing_type", "capsule_core_medication"."refrigeration_type", "capsule_core_medication"."strength", "capsule_core_medication"."unknown_status", "capsule_core_patientmedication"."last_delivered_fill_id", "capsule_core_prescriptionfulfillment"."price", "capsule_core_prescriptionfulfillment"."price_at_checkout", "capsule_core_prescriptionfulfillment"."should_waive_copay", "capsule_core_prescriptionfulfillment"."updated_at", "capsule_core_patientmedication"."upcoming_fill_id", T5."price", T5."price_at_checkout", T5."should_waive_copay", T5."updated_at", "capsule_core_patientmedication"."active_rx_i
@juanandresnyc
juanandresnyc / old.sql
Last active December 6, 2019 14:29
Patient Medication old query
SELECT
"capsule_core_patientmedication"."id", "capsule_core_patientmedication"."deleted_at", "capsule_core_patientmedication"."created_at", "capsule_core_patientmedication"."updated_at", "capsule_core_patientmedication"."is_hidden", "capsule_core_patientmedication"."active_rx_id", "capsule_core_patientmedication"."last_delivered_fill_id", "capsule_core_patientmedication"."upcoming_fill_id", "capsule_core_patientmedication"."medication_id", "capsule_core_patientmedication"."next_refill_date", "capsule_core_patientmedication"."patient_id", "capsule_core_patientmedication"."retrieval_preference", "capsule_core_patientmedication"."should_process_refill", "capsule_core_patientmedication"."should_precheck_next_fill", "capsule_core_patientmedication"."standard_fill_size", "capsule_core_patientmedication"."status", "capsule_core_prescription"."id", "capsule_core_prescription"."deleted_at", "capsule_core_prescription"."created_at", "capsule_core_prescription"."updated_at", "capsule_core_prescription"."patient_medic
@juanandresnyc
juanandresnyc / bst.py
Last active November 17, 2018 16:01
BST python implementation
def bst():
pass
@juanandresnyc
juanandresnyc / create_invalid_filename.js
Created October 12, 2016 21:04
create invalid filename
// Uses node v6
var fs = require('fs');
var filename = Buffer.from('file_with_invalid_character\u0008.txt').toString();
fs.writeFile(filename, 'body', function(err) {
console.log('done', err);
});
@juanandresnyc
juanandresnyc / unique_variant_name_test.js
Last active November 11, 2015 19:53
Tests technique to check for uniqueness works
require('./../lib/env');
Product.get('prototype-movie-2151', function(err, product) {
if (err) throw err;
console.log(testUniqueness(product, 1000, 1000, 300) ? 'passed' : 'failed');
});
function populateProductWithFakeUniqueVariants(product, count) {
product.variants = {};
for (var i = 0; i < count; i++) {
@juanandresnyc
juanandresnyc / dfs.js
Last active April 27, 2017 06:43
find all combinations in '123456789' that lead to 100 with +/- opts (hint: DFS)
// https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
// Answer to prob#5
function dfs(currentPath, currentValue, str) {
var strLen = str.length;
if (strLen < 2) {
if (strLen === 0 || str === '') {
if (currentValue === 100) console.log(currentPath);
} else {
var lastValue = parseInt(str, 10);
@juanandresnyc
juanandresnyc / getLargest.js
Created May 17, 2015 03:22
Solution to P4 from Santiago L. Valdarrama
//https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour?utm_content=bufferf0b7c&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
function getLargestNumber(list) {
var i, str, strLen;
var listLen = list.length;
var largestNumDigits = 0;
var strList = [];
var sameLengthList = [];