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
| /// <summary> | |
| /// Gets the document store. | |
| /// </summary> | |
| /// <returns>The document store.</returns> | |
| private static IDocumentStore GetDocumentStore() | |
| { | |
| // Create the DocumentStore (expensive operation). | |
| IDocumentStore documentStore = new DocumentStore | |
| { | |
| ConnectionStringName = "RavenDB", |
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 NLog; | |
| using Raven.Client; | |
| using Raven.Client.Document; | |
| using Raven.Client.Exceptions; | |
| using System; | |
| using System.Threading.Tasks; | |
| namespace Beyond.Services | |
| { | |
| /// <summary> |
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 NLog; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Text; | |
| namespace Brian.Federici | |
| { |
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
| /// <summary> | |
| /// POST: /UploadImage | |
| /// Saves an image to the server, resizing it appropriately. | |
| /// </summary> | |
| /// <returns>A JSON response.</returns> | |
| [HttpPost] | |
| public ActionResult UploadImage(int id) | |
| { | |
| // Validate we have a file being posted | |
| if (Request.Files.Count == 0) |
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
| <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
| <extensions> | |
| <add assembly="Assembly.Namespace" /> | |
| </extensions> | |
| <targets> | |
| <target xsi:type="Debugger" name="Debugger" /> | |
| <target xsi:type="Mail" name="Mailer" html="true" addNewLines="true" to="[email protected]" bcc="" cc="" from=""Brian Federici" <[email protected]>" smtpUserName="smtpUser" enableSsl="false" smtpPassword="smtpPassword" smtpAuthentication="Basic" smtpServer="192.168.1.100" smtpPort="25" /> | |
| <target xsi:type="File" name="file" layout="${longdate} ${logger} ${message}" fileName="${basedir}/${level}.log" /> | |
| </targets> | |
| <rules> |
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 GetModelDescription() | |
| { | |
| var sb = new StringBuilder(); | |
| var type = typeof(YourType); | |
| sb.AppendFormat("{0} ({1})\n", type.Name, type.UnderlyingSystemType.ToString()); | |
| AppendPropertiesDescription(type, sb, " "); | |
| return sb.ToString(); | |
| } | |
| private void AppendPropertiesDescription(Type type, StringBuilder sb, string prefix) |
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 NLog; | |
| using System; | |
| using System.Threading.Tasks; | |
| using System.Web.Hosting; | |
| namespace Web.Models | |
| { | |
| /// <summary> | |
| /// Static class for running background tasks in IIS. | |
| /// Any spawned threads are registered properly with IIS |
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
| <!-- | |
| Given the following files in C:\ | |
| * app.1.config | |
| * app.2.config | |
| * app.3.config | |
| * file.txt | |
| This task will perform 3 iterations and set ${filename} to the following: | |
| * C:\app.1.config | |
| * C:\app.2.config |
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
| /* | |
| Make sure to wrap a using() around any calls to DownloadAndResizeStream: | |
| using (var stream = DownloadAndResizeStream(uri, 100, 100, true)) { | |
| // Do what you need to with "stream" here | |
| } | |
| */ | |
| private Stream DownloadAndResizeStream(Uri sourceImageUrl, int width, int height, bool crop) | |
| { |
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
| /// <summary> | |
| /// Encapsulates extension methods related to compression. | |
| /// </summary> | |
| public static class CompressionExtensions | |
| { | |
| /// <summary> | |
| /// Compresses <paramref name="uncompressedString"/> and returns the result. | |
| /// </summary> | |
| /// <param name="uncompressedString">An uncompressed string.</param> | |
| /// <returns>A base-64 string.</returns> |
OlderNewer