Skip to content

Instantly share code, notes, and snippets.

@jakebathman
jakebathman / StringConcat.vbs
Created Aug 18, 2015
Concatenate a range of strings in Excel, using VBA From http://www.cpearson.com/excel/stringconcatenation.aspx
View StringConcat.vbs
Function StringConcat(Sep As String, ParamArray Args()) As Variant
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' StringConcat
' By Chip Pearson, chip@cpearson.com, www.cpearson.com
' www.cpearson.com/Excel/stringconcatenation.aspx
' This function concatenates all the elements in the Args array,
' delimited by the Sep character, into a single string. This function
' can be used in an array formula. There is a VBA imposed limit that
' a string in a passed in array (e.g., calling this function from
' an array formula in a worksheet cell) must be less than 256 characters.
@jakebathman
jakebathman / icd_regex.md
Last active Apr 8, 2021
ICD-9 and ICD-10 code regex
View icd_regex.md

ICD code matching regex

The regex patterns below only help validate when something is not valid ICD-10 or ICD-9. They do not ensure that the code exists. You should consult a list of valid ICD codes for that level of verification.

ICD-10-CM list: https://gist.github.com/jakebathman/063c50cb9772e4bfc864a9e1ff4ccc8d

ICD-9 list: https://gist.github.com/jakebathman/f1ed0d473f12091a708243b0ddf03d82

ICD-10/ICD-9 combined regex

Useful for validating field values that could contain both, and may or may not use decimals

@jakebathman
jakebathman / StateBoundaries.sql
Last active Mar 24, 2021
The approximate max/min latitude and longitude for all states and major territories
View StateBoundaries.sql
-- Create the table
CREATE TABLE IF NOT EXISTS `StateBoundaries` (
`State` varchar(10) DEFAULT NULL,
`Name` varchar(255) DEFAULT NULL,
`MinLat` varchar(50) DEFAULT NULL,
`MaxLat` varchar(50) DEFAULT NULL,
`MinLon` varchar(50) DEFAULT NULL,
`MaxLon` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@jakebathman
jakebathman / remove_laravel_comments.php
Last active Mar 9, 2021
Remove comments from fresh Laravel files
View remove_laravel_comments.php
<?php
/*
|--------------------------------------------------------------------------
| Remove Laravel Comments
|--------------------------------------------------------------------------
|
| Just made a new Laravel project, but don't want all those big
| comment blocks? Put this in the root of your project and run
| "php remove_laravel_comments.php"
|
@jakebathman
jakebathman / jsonToCsv.php
Last active Mar 4, 2021 — forked from Kostanos/json-to-csv.php
A function to convert a JSON string (or a PHP array) to a CSV file or CSV string echoed to the browser
View jsonToCsv.php
<?php
/*
*
* Based on (forked from) the work by https://gist.github.com/Kostanos
*
* This revision allows the PHP file to be included/required in another PHP file and called as a function, rather than focusing on command line usage.
*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
@jakebathman
jakebathman / te-snippets-to-alfred.php
Created Jan 29, 2021
Convert TextExpander exported CSV file to an Alfred 4 snippets import file
View te-snippets-to-alfred.php
<?php
$input = $argv[1] ?? 'snippets.csv';
$file = fopen($input, 'r');
$outputDir = pathinfo($input, PATHINFO_FILENAME);
$snippetFiles = [];
// Make the temp output directory
if (! file_exists($outputDir)) {
@jakebathman
jakebathman / arrayToTable.php
Created Aug 14, 2017
Make a quick HTML table from a PHP array
View arrayToTable.php
function arrayToTable(array $values, array $headers = [])
{
$options = [
'tableStyle' => 'border: 1px solid black;border-collapse: collapse;',
'thStyle' => 'border: 1px solid black;padding: 5px 7px;text-align: center;',
'tdStyle' => 'border: 1px solid black;padding: 5px 7px;text-align: center;',
];
$th = "<th style='" . $options['thStyle'] . "'>";
$td = "<td style='" . $options['tdStyle'] . "'>";
View interview.php
<?php
$host = 'palindromer-bd7e0fc867d57915.elb.us-east-1.amazonaws.com';
$port = 7777;
$socket = fsockopen($host, $port);
if (! $socket) {
die('Error: connection not successful');
}
@jakebathman
jakebathman / user-agents.txt
Last active Jan 8, 2021
A list of major user agent strings for different browsers and devices
View user-agents.txt
Chrome/Windows: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome/Windows: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome/Windows: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome/macOS: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome/Linux: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Chrome/iPhone: Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.77 Mobile/15E148 Safari/604.1
Chrome/iPhone (request desktop): Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87 Version/11.1.1 Safari/605.1.15
Chrome/iPad: Mozilla/5.0 (iPad; CPU OS 14_3 like Mac OS X) AppleWebKit/605.1.1
@jakebathman
jakebathman / centos_setup.sh
Created Mar 14, 2017
CentOS box initial setup script
View centos_setup.sh
#!/bin/bash
# Base box setup steps
# Do the steps below as root user
sudo su
# The steps below are based on a clean install on
# CentOS 7 (build 1608)
# http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1608.raw.tar.gz