Skip to content

Instantly share code, notes, and snippets.

View tjmoses's full-sized avatar

Tim Moses tjmoses

  • United States
View GitHub Profile
@tjmoses
tjmoses / javascript-holiday-validation.js
Last active January 18, 2022 14:40
Javascript Holidays using built-in date function (static & floating)
function isHoliday(date: Date) {
const holidays = {
MD: {
// Month, Day
'1/1': "New Year's Day",
'7/4': 'Independence Day',
'11/11': "Veteran's Day",
'12/25': 'Christmas Day',
'12/31': "New Year's Eve"
},
@tjmoses
tjmoses / phpvnode.php
Last active January 18, 2022 15:08
PHP 8 vs Node JS Execution Speed (using built in sort)
<?php
$myArray = [];
$arraySize = 100000;
for ($i = 0; $i < $arraySize; $i++) {
$myArray[$i] = mt_rand(1, 100);
}
$start = hrtime(true);
sort($myArray);
$end = hrtime(true);
$diff = ($end - $start) / 1000;
@tjmoses
tjmoses / mssql_dump.sh
Last active June 17, 2022 07:02
Bash Script to Automate SQL Server Database Backups with mssql-scripter
#!/bin/bash
###################################################################
#Script Name : mssql_dump.sh
#Description : will create SQL scripts as defined by mssql-scripter
# and will zip backup files and store for X days (set to 30)
#Author : Tim Moses
#Github : https://github.com/tjmoses
#Notes : Make sure to add the appropriate MSSQL_SCRIPTER_CONNECTION_STRING
# for your db connection. Also, revise your target & edition
# sql server for the mssql-scripter command below. The zip library is
@tjmoses
tjmoses / .lftp.mockup.rc
Created July 24, 2018 19:35 — forked from gaubert/.lftp.mockup.rc
~/.lftp.rc parameters detailed
########## SETTINGS
# On startup, lftp executes ~/.lftprc and ~/.lftp/rc. You can place aliases and 'set' commands
# there. Some people prefer to see full protocol debug, use 'debug' to turn the debug on.
# Certain commands and settings take a time interval parameter. It has the format Nx[Nx...], where N is time amount
# (floating point) and x is time unit: d - days, h - hours, m - minutes, s - seconds. Default unit is second. E.g.
# 5h30m or 5.5h. Also the interval can be 'infinity', 'inf', 'never', 'forever' - it means infinite interval. E.g.
# 'sleep forever' or 'set dns:cache-expire never'.