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
static void Main() | |
{ | |
Application.EnableVisualStyles(); | |
Application.SetCompatibleTextRenderingDefault(false); | |
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); | |
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | |
Application.Run(new Form1()); | |
} | |
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) |
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
// Requires the use of the Twitterer Nuget package | |
public static RequestResult Tweet(string message) | |
{ | |
var authTokens = new OAuthTokens | |
{ | |
AccessToken = ConfigurationManager.AppSettings["AccessToken"], | |
AccessTokenSecret = ConfigurationManager.AppSettings["AccessTokenSecret"], | |
ConsumerKey = ConfigurationManager.AppSettings["ConsumerKey"], | |
ConsumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"] |
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.Configuration; | |
using System.IO; | |
using System.Net; | |
using System.Text; | |
using System.Xml; | |
namespace MyApp | |
{ | |
public class Bitly | |
{ |
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 Func<HttpContextBase> ContextProvider = () => new HttpContextWrapper(HttpContext.Current); | |
public override bool IsValid(object value) | |
{ | |
if (value == null) return false; | |
var identityName = ContextProvider().User.Identity.Name; | |
// ... | |
} |
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
DirectoryEntry root = new DirectoryEntry("WinNT:"); | |
foreach (DirectoryEntry dom in root.Children) { | |
foreach (DirectoryEntry entry in dom.Children) { | |
if (entry.Name != "Schema") { | |
Console.WriteLine(entry.Name); | |
} | |
} | |
} |
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
$().ready(function() { | |
var $scrollingDiv = $("#scrollingDiv"); | |
$(window).scroll(function(){ | |
$scrollingDiv | |
.stop() | |
.animate({"marginTop": ($(window).scrollTop() + 30) + "px"}, "slow"); | |
}); | |
}); |
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; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
[MetadataType(typeof (FooBarMetaData))] | |
public class FooBar | |
{ | |
// Insert FooBar related properties, methods, etc. here |
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
DateTime now = DateTime.Today; | |
int age = now.Year - bday.Year; | |
if (bday > now.AddYears(-age)) age--; |
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 class ClassName : IDisposable | |
{ | |
#region Variable Declarations | |
private bool _disposed = false; | |
#endregion | |