Skip to content

Instantly share code, notes, and snippets.

@matijagrcic
matijagrcic / ConfigSource.config
Last active August 29, 2015 14:00
Connection strings Azure and basic, deployment
#put in your web.config or app.config
<configuration>
<connectionStrings configSource="connections.config"/>
</configuration>
#this is your connections.config which can be used for several projects, transformations Release,Debug etc.
<configuration>
@matijagrcic
matijagrcic / GmailAzure.cs
Created April 21, 2014 07:16
Use Gmail to send email from Azure
var smtp = new SmtpClient
{
Host = "smtp.gmail.com",
Port = 587,
EnableSsl = true,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(fromAddress.Address, "yourApplicationSpecificPassword")
};
using (var message = new MailMessage(fromAddress, toAddress)
google.visualization.events.addListener(chart, 'ready', function () {
chart-container.innerHTML = '<img src="' + chart.getImageURI() + '">';
});
<div id='png'></div>
document.getElementById('png').outerHTML = '<a href="' + chart.getImageURI() + '">Printable chart</a>';
public async Task ListLabels()
{
UserCredential credential;
using (var stream = new FileStream("client_secrets_desktop.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets,
new[] { GmailService.Scope.GmailReadonly },
"user", CancellationToken.None);
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="Content/bootstrap.css" rel="stylesheet" />
</head>
<body>
<handlers>
<add name="HtmlFileHandler" path="*.html" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
routes.MapRoute(
name: "Default",
url: "{controller}/{action}.html",
defaults: new { controller = "Home", action="Index" }
);
@matijagrcic
matijagrcic / No YouTube Ads.css
Last active May 13, 2020 10:45
No ads on YouTube, install Stylish for Chrome https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en add new style for URLs on the domain: youtube.com, also install https://userstyles.org/styles/117673/darktube
.ytp-ad-overlay-container{
display: none;
}
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Logs](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Message] [nvarchar](max) NULL,
[MessageTemplate] [nvarchar](max) NULL,
Thought experiment:
Listened to eight .NET Rocks episodes yesterday while driving. One episode was about C# 6.0 with Bill Wagner
(http://www.dotnetrocks.com/default.aspx?showNum=1029), another about DDD with Steve Smith and Julie Lerman
(http://www.dotnetrocks.com/default.aspx?showNum=1023) where they specifically also discussed DDD's notion of
an anti-corruption layer, which aims to provide a neutral zone between different domains. The combination of
the two episodes gave me the following idea which I'll jot down here quickly.
Don't go "you dont do that in DDD, because .." since that's not the point. The point is efficiency and avoiding
data copies. Also, I'm not planning on doing anything further with it, so if anyone wants to take this somewhere,
<urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
<httpCompression noCompressionForHttp10="false" noCompressionForProxies="false" dynamicCompressionDisableCpuUsage="93" dynamicCompressionEnableCpuUsage="93" staticCompressionDisableCpuUsage="99" staticCompressionEnableCpuUsage="99">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9" dynamicCompressionLevel="4" />
</httpCompression>