Skip to content

Instantly share code, notes, and snippets.

Avatar

Goran Žuri gzuri

View GitHub Profile
@gzuri
gzuri / csharp_GPS_converter.cs
Created Jul 19, 2012
C# GPS location format converter
View csharp_GPS_converter.cs
public static void ConvertDecimalToSexagesimal(decimal input, out int deg, out int min, out int sec)
{
if (input < 0)
{
input = -input;
}
deg = (int)input;
min = (int)Math.Round((input - deg) * 60);
sec = (int)Math.Round((((input - deg) - (decimal)min / 60) * 3600), 0);
@gzuri
gzuri / C# send email
Created Jun 1, 2012
Simple C# send email code snippet
View C# send email
public static bool SendEmail(string mailTo, string subject, string message) {
string mailFrom = ConfigurationManager.AppSettings.Get("MailAddress");
string username = ConfigurationManager.AppSettings.Get("MailUsername");
string password = ConfigurationManager.AppSettings.Get("MailPassword");
int port = Convert.ToInt32(ConfigurationManager.AppSettings.Get("MailOutgoingPort"));
string mailServer = ConfigurationManager.AppSettings.Get("MailServer");
try
{
MailMessage mailMessage = new MailMessage(mailFrom, mailTo, subject, message);
@gzuri
gzuri / ASP.NET MVC performance attribute
Created May 8, 2012
Provides a basic performance measuring in MVC for each rendered action.
View ASP.NET MVC performance attribute
public class StopwatchActionFilter : ActionFilterAttribute
{
private readonly Dictionary<string, Stopwatch> _stopWatches;
public StopwatchActionFilter()
{
if (_stopWatches == null)
_stopWatches = new Dictionary<string, Stopwatch>();
}