This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function phonePartsUSA(phoneNumberInput) { | |
const phoneNumber = ("" + phoneNumberInput).replace(/[^0-9]/g, ""); | |
if (phoneNumber.length != 10) throw new Error("phoneNumberInput must have 10 digits"); | |
const areacode = phoneNumber.slice(0, 3); | |
const prefix = phoneNumber.slice(3, 6); | |
const exchange = phoneNumber.slice(6, 10); | |
const dialnumber = prefix + exchange; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function assert(condition, message) { | |
if (!condition) { | |
throw new Error("Assertion failed: [" + (message || "no message") + "]" ); | |
} | |
} | |
function randomDate(start, end) { | |
assert(start < end,"start < end"); | |
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for f in *.csv; do (head -n1 $f |tr '[A-Z]' '[a-z]'; tail -n +2 $f) > ./lower/$f; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
IF %1.==. GOTO NoHtmlFile | |
SET CURRENTDIR=%cd% | |
set htmlFile=%1 | |
start "C:\Program Files (x86)\Google\Chrome\Application" chrome.exe --headless --disable-gpu --no-margins --print-to-pdf="%CURRENTDIR%\%htmlFile%.pdf" "%CURRENTDIR%\%htmlFile%" | |
GOTO End1 | |
:NoHtmlFile | |
ECHO Must specify HTML file or URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jamesdaily.spotbugs.FileDescriptorLeak; | |
import java.io.IOException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.stream.Stream; | |
public class FilesListExample { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION assertEquals (pinInput VARCHAR2, pinExpectedValue VARCHAR2) | |
RETURN VARCHAR2 | |
IS | |
/* | |
James Daily 3/25/2016 | |
Helper function for comparing values in SQL queries | |
Copyright (c) 2016 James David Daily | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jamesdaily.study; | |
public class Stick implements Comparable<Stick> { | |
protected Integer length; | |
public Stick(Integer length) { | |
if (length == 0) | |
throw new IllegalArgumentException("Stick cannot be length 0!"); | |
if (length < 0) | |
throw new IllegalArgumentException( |