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
| // NOTE: if the file is embedded in the executing assembly, this code can be simplified | |
| // NOTE: this works even if the file is not embedded in the executing assembly | |
| private async Task<string> GetEmbeddedFile(string fileName) | |
| { | |
| // NOTE: this code is not great but allows us to have the stored procedure js in the TryAzureCdn.Data project | |
| // Resources (.resx file) are not working with embedded files | |
| var assembly = typeof(DocumentDBRepository).GetTypeInfo().Assembly; | |
| var resourceName = assembly.GetManifestResourceNames().FirstOrDefault(m => m.Contains(fileName)); | |
| Stream resourceStream = assembly.GetManifestResourceStream(resourceName); | |
| string fileContents = string.Empty; |
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
| public async Task CreateDatabaseIfNotExistsAsync() | |
| { | |
| var databaseLink = UriFactory.CreateDatabaseUri(this.databaseSettings.DatabaseId); | |
| // create database | |
| await this.databaseClient.CreateDatabaseIfNotExistsAsync(new Database { Id = this.databaseSettings.DatabaseId }); | |
| // create collection | |
| var collectionDefinition = new DocumentCollection { Id = this.databaseSettings.CollectionId }; | |
| collectionDefinition.IndexingPolicy = new IndexingPolicy(new RangeIndex(DataType.String) { Precision = -1 }); |
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
| msbuild MySite.csproj | |
| /p:Configuration=Release | |
| /p:DeployOnBuild=true | |
| /p:DeployTarget=MsDeployPublish | |
| /p:MsDeployServiceUrl=my-site.scm.azurewebsites.net:443 | |
| /p:UserName=$my-site | |
| /p:Password=XXX | |
| /p:DeployIisAppPath=my-site | |
| /p:SkipExtraFilesOnServer=true |
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
| // this code assumes a credit card is valid in the current month | |
| var validateDate = function () { | |
| var creditCardDate = moment($scope.data.expirationYear+$scope.data.expirationMonth, "YYMM"); | |
| var today = moment(); | |
| return creditCardDate.isValid() && (today < creditCardDate.add(1, 'months')); | |
| } |
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
| <!-- Definition --> | |
| <svg style="display: none" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
| <symbol id="bank-icon"> | |
| <path d="M512 480v-32h-32v-192h32v-32h-96v32h32v192h-96v-192h32v-32h-96v32h32v192h-96v-192h32v-32h-96v32h32v192h-96v-192h32v-32h-96v32h32v192h-32v32h-32v32h544v-32h-32z"></path> | |
| <path d="M256 0h32l256 160v32h-544v-32l256-160z"></path> | |
| </symbol> | |
| </svg> | |
| <!-- Usage --> | |
| <div class="col col-20"> |
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
| private string GetDomainFromRequest() | |
| { | |
| return this.Request.Url.Scheme + Uri.SchemeDelimiter + this.Request.Url.Host; | |
| } |
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
| private static readonly string[] IgnoreMethods = | |
| { | |
| "Web.Controllers.CaseStudiesController.CaseStudiesApi", | |
| "Web.Controllers.DocumentationController.DocArticlesApi", | |
| "Web.Controllers.VideosController.AzureFridayResults", | |
| "Web.Controllers.ChannelCalculatorController.PostEstimate", | |
| "Web.Controllers.ChannelCalculatorController.GetExcelExportedFileFromCalculator" | |
| }; | |
| [TestMethod] |
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
| <Target Name="AdditionalFilesForPackage" AfterTargets="CopyAllFilesToSingleFolderForPackage;CopyAllFilesToSingleFolderForMsDeploy"> | |
| <ItemGroup> | |
| <AppDataFiles Include="$(MSBuildProjectDirectory)\App_Data\**\*" /> | |
| </ItemGroup> | |
| <Copy SourceFiles="@(AppDataFiles)" DestinationFiles="@(AppDataFiles->'$(_PackageTempDir)\App_Data\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" /> | |
| </Target> |
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
| using System.IO; | |
| using (var streamReader = File.OpenText("myfile.txt")) | |
| { | |
| string line = streamReader.ReadLine(); | |
| while (line != null) | |
| { | |
| Console.WriteLine(line); | |
| line = streamReader.ReadLine(); | |
| } |
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
| public static string Reverse( string s ) | |
| { | |
| char[] charArray = s.ToCharArray(); | |
| Array.Reverse( charArray ); | |
| return new string( charArray ); | |
| } |