This file contains hidden or 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
// SPDX-License-Identifier: MIT | |
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) | |
pragma solidity ^0.8.0; | |
import "./IAccessControl.sol"; | |
import "../utils/Context.sol"; | |
import "../utils/Strings.sol"; | |
import "../utils/introspection/ERC165.sol"; |
This file contains hidden or 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
{ | |
# fetch an account by its public address | |
accountState(address: "3584d309264da2a85991b2bcdc44b7c7") { | |
sequenceNumber | |
authenticationKey | |
# scan sent events for this addresss | |
sentEvents(limit: 1) { | |
sequenceNumber | |
data { |
This file contains hidden or 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
from teamcity import is_running_under_teamcity | |
from teamcity.unittestpy import TeamcityTestRunner | |
import os | |
import unittest | |
# update these variables to configure how the test runner loads the test suite | |
testsPath = './tests' | |
testsPattern = '*_test.py' |
This file contains hidden or 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
// I had a requirement to read a file from local storage, compress the content, the encrypt the data with a password. | |
// There are many ways to do this, but I wanted to do it the most efficient and elegant way possible. | |
// This method takes advantage of using Streams (which pipe data between streams), which gives us a clean and efficient solution. | |
// I am using all the generally accepted best practices to accomplish the task at hand. | |
// I have implemented the solution as an extension method to simplify usage. | |
public static partial class ExtensionMethods | |
{ | |
#region File Encryption / Decryption | |
// WARN: this is an empty salt, create your own random salt using |
This file contains hidden or 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
// handy extension method to reduce a DateTime to the precision of a T-SQL DATETIME so that you can compare it with | |
// CLR DateTime's in unit tests | |
public static partial class ExtensionMethods | |
{ | |
public static DateTime ToSqlDateTimePrecision(this DateTime source) | |
{ | |
using (var ctx = new Data.DataContext()) | |
{ | |
return ctx.ExecuteQuery<DateTime>(string.Format("SELECT CONVERT(DATETIME, '{0}', 0)", source)).Single(); | |
} |
This file contains hidden or 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
namespace Test | |
{ | |
public static class INotifyPropertyChangedExtensions | |
{ | |
public static IObservable<EventPattern<PropertyChangedEventArgs>> FromPropertyChangedPattern(this INotifyPropertyChanged source) | |
{ | |
return Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>( | |
x => source.PropertyChanged += x, | |
x => source.PropertyChanged -= x); | |
} |