Skip to content

Instantly share code, notes, and snippets.

View psenger's full-sized avatar
:octocat:
Makin Bacon

Philip A Senger psenger

:octocat:
Makin Bacon
View GitHub Profile
@psenger
psenger / finding-a-committed-bug-with-Git.md
Last active October 5, 2023 20:57
[Finding a committed bug with Git] #git #git-bisect #bug

Finding a committed bug with Git CLI

git-bisect - Use binary search to find the commit that introduced a bug

Basic bisect commands: start, bad, good

As an example, suppose you are trying to find the commit that broke a feature that was known to work in version v2.6.13-rc2 of your project. You start a bisect session as follows:

@psenger
psenger / README.md
Created August 25, 2023 03:49
[HTML CSS Row Cells with Nice Borders] #HTML #CSS

HTML CSS Row Cells with Nice Borders

I want a row of cells, with nice borders. this kind of works, needs a little more work

<div class="container">
  <div class="cell">Cell 1</div>
  <div class="cell">Cell 2</div>
  <div class="cell">Cell 3</div>
  <!-- Add more cells as needed -->
@psenger
psenger / Readme.md
Last active August 21, 2023 01:32
[With Docker, pull a specific image from local docker, and then push that to a remote registry] #Docker

To pull a specific Docker image from your local machine and then push it to a remote Docker registry, you can follow these steps:

  1. Pull the Image Locally: Open a terminal window and use the docker pull command to pull the specific image you want from your local machine. Replace local-image:tag with the name and tag of the image you want to pull.
docker pull local-image:tag
  1. Tag the Image:
@psenger
psenger / RemoveRairedTags.md
Last active August 19, 2023 04:34
[Regular Expression that will delete a HTML tags, any attributes, and closing tag, leaving everything in the middle intact] #RegEx

Removing "paired" or "container" tags

You can use the following regular expression to remove the <font> tags and their attributes while leaving the multi-line contentinside intact:

<font\b[^>]*>([\s\S]*?)<\/font\s*>

Explanation:

@psenger
psenger / README.md
Created August 8, 2023 01:26
[Postgres tips and tricks] #Postgres

Tips and Tricks

how to find where the Configuration file is located

psql -U postgres -c 'SHOW config_file'

@psenger
psenger / frontmatter.js
Created August 3, 2023 01:57 — forked from sudkumar/frontmatter.js
MDX Remark plugin to handle frontmatter
// helps us in parsing the frontmatter from text content
const matter = require('gray-matter')
// helps us safely stringigy the frontmatter as a json object
const stringifyObject = require('stringify-object')
// helps us in getting the reading time for a given text
const readingTime = require('reading-time')
// please make sure you have installed these dependencies
// before proceeding further, or remove the require statements
// that you don't use
@psenger
psenger / readme.md
Created July 31, 2023 03:51
[pass - a unix style password manager] #MacOS

pass

stores to a local db called ~/.password-store

@psenger
psenger / passwordPolicyCheck.js
Created July 29, 2023 12:32
[Password Policy Check Functions contains min, min length, special characters, numbers, upper and lower case] #JavaScript #Functional
const minLength = (min) => (str) => (str||'').toString().trim().length >= min
const contains = (chars, min) => (str) => [...((str||'').toString().trim())].filter(char => (new Set(chars)).has(char)).length >= min
const hasLowerCase = contains('abcdefghijklmnopqrstuvwxyz', 1)
const hasUpperCase = contains('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 1)
const hasNumber = contains('0123456789', 1)
const hasSpecialChar = contains('!@#$%^&*()-+_', 1)
const compose = (...fns) => (x) => fns.map((fn) => fn(x))
const passwordPolicyCheck = compose(
minLength(12),
hasLowerCase,
@psenger
psenger / README.md
Last active August 9, 2023 22:41
[Regular Expression to find all the CSS URL functions without quoted URLS] #RegEx #CSS

Regular Expression to find all the CSS URL functions without quoted URLS

to find all url css commands that do not have quoted URLs

url\(([^"'\)]+)\)
  • match case senstivie url(
  • start capture group 1
@psenger
psenger / README.md
Last active July 17, 2023 04:22
[NextJS - when to use Client vs Server Components] #NextJS

NextJS - when to use Client vs Server Components

Client Server
Use React hooks such as useState, useEffect, useReducer Fetch Data
Interactivity within the component, with event listeners (onClick()) Store sensitive information on server (tokens, API keys, etc.)
Use custom hooks that depend on state, effects. Access backend resources directly
Keep large dependencies on the server