Skip to content

Instantly share code, notes, and snippets.

View ninapavlich's full-sized avatar

Nina Pavlich ninapavlich

View GitHub Profile
# Try to get the profile path
PROFILE_PATH=''
getProfilePath(){
if [[ "$SHELL" == *"zsh"* ]]; then
PROFILE_PATH=$HOME/'.zshrc'
elif [[ "$SHELL" == *"bash"* ]]; then
if [ -f $HOME/.bashrc ]; then
PROFILE_PATH=$HOME/'.bashrc'
elif [ -f $HOME/.profile ]; then
PROFILE_PATH=$HOME/'.profile'
@ninapavlich
ninapavlich / format.js
Created March 25, 2020 22:37
Multiple date format parser regex
var possibleDateFormats = [
'Updated on 3/25, 9:35PM',
'Updated on 03/25, 9:35PM',
'Updated 3/25/2020, 9:35PM',
'Updated 3/25/2020 at 9:35PM',
'Updated 3/25/2020 at 9:35 p.m.',
'Updated 3/25 21:35',
'updated on 03/25/20 21:35 PM'
]
/* Last Updated */
{
"version": "0.6",
"reqId": "0",
"status": "ok",
"sig": "2121529001",
"table": {
"cols": [
{
"id": "A",
@ninapavlich
ninapavlich / virginia_doh.json
Created March 18, 2020 00:27
Example Virginia DOH Coronavirus JSON
{
"secondaryInfo": {
"presModelMap": {
"dataDictionary": {
"presModelHolder": {
"genDataDictionaryPresModel": {
"dataSegments": {
"0": {
"dataColumns": [
{
@ninapavlich
ninapavlich / adhs.json
Created March 18, 2020 00:22
Example Arizona ADHS Coronavirus Tableau Data
{
"secondaryInfo": {
"presModelMap": {
"dataDictionary": {
"presModelHolder": {
"genDataDictionaryPresModel": {
"dataSegments": {
"0": {
"dataColumns": [
{
@ninapavlich
ninapavlich / getDataDogAgentStatus.js
Created November 12, 2019 03:13
Check if datadog agent is running
const fetch = require('node-fetch');
const hotShots = require('hot-shots');
const ddAgentHost = process.env.DD_AGENT_HOST || 'localhost';
async function checkAgentStatus() {
let metricsUp = 'OK (no error returned)';
let apmUp = '';
const datadog = new hotShots.StatsD({
@ninapavlich
ninapavlich / sort.js
Last active August 23, 2024 07:37
Deep Sort Javascript Object
function sortObject(object) {
//Thanks > http://whitfin.io/sorting-object-recursively-node-jsjavascript/
if (!object) {
return object;
}
const isArray = object instanceof Array;
var sortedObj = {};
if (isArray) {
sortedObj = object.map((item) => sortObject(item));
@ninapavlich
ninapavlich / bug.js
Last active September 27, 2019 21:50
JIRA Create Bug and Story Bookmarklets
javascript: (async function() {
/* Bug template created by Anna Smith, Program Manager at NYTimes */
const summaryTemplate =
"**Bug Ticket Template** EPIC | Bug : [High-level summary]";
const descriptionTemplate = `*Howdy! This is the bug ticket template. Please copy and paste this when you create a new ticket.* To get started, go to the "Configure Fields" dropdown in the upper right of the Create Issue pop-up screen. Select only the following: Assignee, Attachment, Description, Epic Link, Priority, and Sprint. (You'll only need to do this once.)\n\n\n\n
 
@ninapavlich
ninapavlich / edit.js
Last active September 17, 2019 16:16
Edit Parenting Item
javascript: (async function() {
var bookmarkletVersion = "1.0.0";
var apiRoot = "https://parenting.nytimes.com/api/v1";
var cmsRoot = "https://nyt-parentingcms-prd.appspot.com";
console.log("Running Parenting Edit Bookmarlet v" + bookmarkletVersion);
/*
Generic function for requesting URLs
*/
@ninapavlich
ninapavlich / test_logging.py
Last active May 29, 2019 23:52
Example Django command for testing different logging levels
import logging
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('django')
class Command(BaseCommand):
def handle(self, *args, **options):