Skip to content

Instantly share code, notes, and snippets.

View worp1900's full-sized avatar

worp1900 worp1900

View GitHub Profile
@worp1900
worp1900 / helpful_regular_expressions
Last active October 11, 2017 07:11
Helpful regular expressions (pcre) I often use
(?<![\S"])([^"\s]+)(?![\S"])
Find all strings not enclosed in quotes. Workx ok well. Often used to add quotes to JSON notation that doesn't have it yet. Currently doesn't detect brackets like [, [, }. That needs some fixing.
Source: https://stackoverflow.com/questions/11324749/a-regex-to-detect-string-not-enclosed-in-double-quotes
@worp1900
worp1900 / pre-commit
Created October 5, 2017 06:34 — forked from jaymcgavren/pre-commit
A Git pre-commit hook to keep me from committing stupid stuff.
#!/bin/bash
# Pre commit hook that prevents FORBIDDEN code from being commited.
# Add unwanted code to the FORBIDDEN array as necessary
FILES_PATTERN='\.(rb|js|coffee|erb|scss|css)(\..+)?$'
FORBIDDEN=( TODO binding.pry FIXME )
for i in "${FORBIDDEN[@]}"
do