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
#!/bin/bash | |
STACK_NAME=my-stack-name | |
UPDATING=1 | |
while [ "$UPDATING" -ne 0 ] | |
do | |
stack_status=$(aws cloudformation describe-stacks --stack-name ${STACK_NAME} | jq -r --arg STACK "$STACK_NAME" '[.Stacks[]|select(.StackName==$STACK)][0].StackStatus') | |
if [[ "$stack_status" == "PROCESSING_UPDATE" || "$stack_status" == "PROCESSING_CREATE" ]]; then |
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
// number of sensors | |
const int sensors = 4; | |
// number of frames to smooth | |
const int smoothing = 5; | |
const int minVoltage = 950; | |
const int maxVoltage = 1050; | |
// 2d array to store historic data for all sensors |
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
image: Visual Studio 2017 | |
before_build: | |
- dotnet restore | |
build_script: | |
# use dotnet CLI to publish to subfolder named site | |
- dotnet publish -o site | |
after_build: |
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
Array.from(new Set(yourArray.map((item: any) => item.id))) |
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
const cors = require('cors')({origin: true}); | |
exports.sample = functions.https.onRequest((req, res) => { | |
cors(req, res, () => { | |
res.send('Passed.'); | |
}); | |
}); |
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
using System.Web; | |
using System.Web.Routing; | |
using System.Configuration; | |
namespace MyWebsite.Infrastructure | |
{ | |
public class RobotsTxtHandler : IRouteHandler | |
{ | |
public IHttpHandler GetHttpHandler(RequestContext requestContext) | |
{ |
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
using Elmah; | |
using System; | |
using System.Collections; | |
using System.Text; | |
namespace MyProject | |
{ | |
public class ElmahCustomSqlErrorLog : SqlErrorLog | |
{ | |
public ElmahCustomSqlErrorLog(IDictionary config) : base(config) { } |
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
--~Changing index [dbo].[ELMAH_Error].PK_ELMAH_Error to a clustered index. You may want to pick a different index to cluster on. | |
SET ANSI_NULLS ON | |
SET QUOTED_IDENTIFIER ON | |
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ELMAH_Error]') AND type in (N'U')) | |
BEGIN | |
CREATE TABLE [dbo].[ELMAH_Error]( | |
[ErrorId] [uniqueidentifier] NOT NULL, | |
[Application] [nvarchar](60) NOT NULL, | |
[Host] [nvarchar](50) NOT NULL, | |
[Type] [nvarchar](100) NOT 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
public static byte[] GenerateSiteMap(IPublishedContent model) | |
{ | |
var sites = model.Parent.Children.Where(x => x.DocumentTypeAlias == "HomePage" || x.DocumentTypeAlias == "SatelliteHomePage"); | |
var baseUrl = string.Format("{0}://{1}", HttpContext.Current.Request.IsSecureConnection ? "https" : "http", HttpContext.Current.Request.Url.Host); | |
var siteMap = new XmlSiteMap(); | |
foreach (var homePage in sites) | |
{ |
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
public static string GetGravatarImageUrl(string emailAddress) | |
{ | |
// Create MD5 Hash of email address | |
var md5 = System.Security.Cryptography.MD5.Create(); | |
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(emailAddress.Trim().ToLower()); | |
byte[] hash = md5.ComputeHash(inputBytes); | |
// Create lower-case hex string | |
var sb = new System.Text.StringBuilder(); | |
for (int i = 0; i < hash.Length; i++) |