Skip to content

Instantly share code, notes, and snippets.

View profile.sh
# 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 Mar 25, 2020
Multiple date format parser regex
View format.js
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'
]
View gist:ccd8b35f8807b4a80456aedf68365493
/* Last Updated */
{
"version": "0.6",
"reqId": "0",
"status": "ok",
"sig": "2121529001",
"table": {
"cols": [
{
"id": "A",
@ninapavlich
ninapavlich / virginia_doh.json
Created Mar 18, 2020
Example Virginia DOH Coronavirus JSON
View virginia_doh.json
{
"secondaryInfo": {
"presModelMap": {
"dataDictionary": {
"presModelHolder": {
"genDataDictionaryPresModel": {
"dataSegments": {
"0": {
"dataColumns": [
{
@ninapavlich
ninapavlich / adhs.json
Created Mar 18, 2020
Example Arizona ADHS Coronavirus Tableau Data
View adhs.json
{
"secondaryInfo": {
"presModelMap": {
"dataDictionary": {
"presModelHolder": {
"genDataDictionaryPresModel": {
"dataSegments": {
"0": {
"dataColumns": [
{
@ninapavlich
ninapavlich / getDataDogAgentStatus.js
Created Nov 12, 2019
Check if datadog agent is running
View getDataDogAgentStatus.js
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 Mar 8, 2022
Deep Sort Javascript Object
View sort.js
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 Sep 27, 2019
JIRA Create Bug and Story Bookmarklets
View bug.js
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 Sep 17, 2019
Edit Parenting Item
View edit.js
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
Example Django command for testing different logging levels
View test_logging.py
import logging
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('django')
class Command(BaseCommand):
def handle(self, *args, **options):