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
// A small toy program to explore some of what we can do with the | |
// 'type_safe' library: https://github.com/foonathan/type_safe/ | |
// We will see that we can use it to create distinct new integer types, | |
// capable of ordinary arithmetic, and *without* implicit conversions. | |
// | |
// We will use this to implement Ada-style strong typing, protecting | |
// against confusing a NumApples_type value with a NumPennies_type value. | |
// |
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
// A small toy program (in fact it does nothing at all) | |
// to explore what we can do with BOOST_STRONG_TYPEDEF. | |
// We will see that it creates a distinct new type, with permissive | |
// implicit conversions regarding the original type. | |
// | |
// BOOST_STRONG_TYPEDEF has its uses, but we will see that we can't use | |
// BOOST_STRONG_TYPEDEF to implement Ada-style strong typing, such as to protect | |
// against confusing a NumApples_type value with a NumPennies_type value. |
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
-- Prints a nondeterministic integer value | |
with Ada.Text_IO; use Ada.Text_IO; | |
procedure Hello is | |
subtype NumFingers is Integer range 0..10; | |
my_num_fingers : NumFingers; -- := 4; | |
begin |
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
## Amazon Lambda script: start all appropriately tagged instances | |
## | |
## Runs in Amazon Lambda as Python 2.7 or as Python 3.6. | |
## Intended to be invoked on a schedule by Amazon Cloud Watch. | |
## Tag relevant instances with label 'autostart', value 'true'. | |
## TODO It could be good to add logging to this script |
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
System.Text.RegularExpressions.Regex separatorRegex1 | |
= new System.Text.RegularExpressions.Regex("a"); | |
System.Text.RegularExpressions.Regex separatorRegex2 | |
= new System.Text.RegularExpressions.Regex("(a)"); | |
string str = "a"; | |
string[] split1 = separatorRegex1.Split(str); // { "", "" } | |
string[] split2 = separatorRegex2.Split(str); // { "", "a", "" } |