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
// convertJSONValues.js 10/17/16 | |
// node.js file to convert values in a json object / array to the specified format | |
// This came about because the powershell cmdlets import-csv, ConvertTo-Json store | |
// numbers as strings | |
var fs = require("fs") | |
// input #1 - specify file path | |
var jsonFilePath = "./activities.json"; |
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
#"You forgot to give Professor Boolean's favorite rabbit specimen a name? | |
# You know how picky the professor is! Only particular names will do! Fix this immediately, before you're... eliminated!" | |
# Luckily, your minion friend has already come up with a list of possible names, and we all know that the professor | |
# has always had a thing for names with lots of letters near the 'tail end' of the alphabet, so to speak. You realize | |
# that if you assign the value 1 to the letter A, 2 to B, and so on up to 26 for Z, and add up the values for all of the | |
# letters, the names with the highest total values will be the professor's favorites. For example, | |
# the name Annie has value 1 + 14 + 14 + 9 + 5 = 43, while the name Earz, though shorter, has value 5 + 1 + 18 + 26 = 50. | |
# If two names have the same value, Professor Boolean prefers the lexicographically larger name. | |
# For example, if the names were AL (value 13) and CJ (value 13), he prefers CJ. | |
# Write a function answer(names) which takes a list of names and re |
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
# write a function answer(n) which returns the smallest positive integer base b, at least 2, | |
# in which the integer n is a palindrome. The input n will satisfy "0 <= n <= 1000." | |
def answer(n): | |
base = 1 | |
num1 = -1 | |
num2 = 0 | |
while num1 != num2: | |
base = base + 1 |
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 TABLE tempdb.dbo.temp1 | |
( | |
Temp1Id INT IDENTITY(1,1) NOT NULL | |
CONSTRAINT temp1PrimaryKey PRIMARY KEY CLUSTERED, | |
VALUE VARCHAR(25), | |
DateModified datetime2, | |
DateCreated datetime2 default getdate() | |
) | |
GO |
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
-- SQL Server 2012 New String Functions | |
-- CONCAT | |
select concat('Hello', ', ','World!') -- Hello, World! | |
select 'Hello' + ', ' + 'World!' -- Hello, World! | |
select concat('Hello', null,'World!') -- HelloWorld! | |
select 'Hello' + null + 'World!' -- NULL |
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
-- SQL 2012 Logical functions | |
-- 6/1/15 | |
-- CHOOSE | |
-- must be an integer | |
declare @Index_Value int | |
set @Index_Value = 1 |
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
-- SQL Server 2012, 2014 new date time functions | |
-- 6/1/2015 | |
declare @date_example_1 datetime | |
set @date_example_1 = DATETIMEFROMPARTS( | |
2015, -- year | |
6, -- month | |
1, -- day | |
7, -- hours | |
16, -- minutes |
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
-- SQL Server 2012 / 2014 Parsing examples | |
-- Parsing | |
declare @String_To_Date_Example_1 datetime2 | |
set @String_To_Date_Example_1 = parse('Friday, May 29 2015 11:21 AM' as datetime2) | |
select @String_To_Date_Example_1 | |
/* -- Fails | |
declare @String_To_Date_Example_2 datetime2 |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<_locDefinition xmlns="urn:locstudio"> | |
<_locDefault _loc="locNone" /> | |
<_locTag _loc="locData">Title</_locTag> | |
<_locTag _loc="locData">Description</_locTag> | |
<_locTag _loc="locData">Author</_locTag> | |
<_locTag _loc="locData">ToolTip</_locTag> | |
</_locDefinition> | |
<CodeSnippet Format="1.0.0"> |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<_locDefinition xmlns="urn:locstudio"> | |
<_locDefault _loc="locNone" /> | |
<_locTag _loc="locData">Title</_locTag> | |
<_locTag _loc="locData">Description</_locTag> | |
<_locTag _loc="locData">Author</_locTag> | |
<_locTag _loc="locData">ToolTip</_locTag> | |
</_locDefinition> | |
<CodeSnippet Format="1.0.0"> |
NewerOlder