Skip to content

Instantly share code, notes, and snippets.

View ninapavlich's full-sized avatar

Nina Pavlich ninapavlich

View GitHub Profile
@ninapavlich
ninapavlich / svgreset.tsx
Last active March 14, 2025 17:08
My approach for Adding SVG icons that resize correctly within text
const svgReset = css`
/* Visually match height of text... */
/* this is to replace the Ink style which uses REMs and doesn't allow the component */
width: auto;
height: 1em;
vertical-align: middle;
`
export const playIcon = css`
${svgReset};
@ninapavlich
ninapavlich / splitParagraphIntoSentences.ts
Created January 24, 2025 16:35
Splits paragraphs into sentence, handling certain edge cases
// Based off snippet from: https://stackoverflow.com/questions/4576077/how-can-i-split-a-text-into-sentences
/*
Example outputs:
Handles ambiguous appbreviation and sentence ending:
console.log(splitParagraphIntoSentences('This is a sentence. Mr. Smith went to N.Y.C. He said, "Hello!"'))
[
"This is a sentence.",
# 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