Skip to content

Instantly share code, notes, and snippets.

📈
Focusing

Chris S. yetanotherchris

📈
Focusing
Block or report user

Report or block yetanotherchris

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:369741
/// <summary>
/// Writes the args to the default logging output using the format provided.
/// </summary>
public static void WriteLine(LoggingLevel level,string format, params object[] args)
{
var name = new StackFrame(2,false).GetMethod().Name;
string prefix = string.Format("[{0} - {1}] ",level,name);
string message = string.Format(prefix + format, args);
View ExternalXmlSummaryCache.GetSummary-fix.cs
/// <summary>
/// Returns the original summary for a member inherited from a specified type.
/// </summary>
/// <param name="memberID">The member ID to lookup.</param>
/// <param name="declaringType">The type that declares that member.</param>
/// <returns>The summary xml. If not found, returns an zero length string.</returns>
public string GetSummary(string memberID, Type declaringType) {
//extract member type (T:, P:, etc.)
string memberType = memberID.Substring(0, 2);
View gist:1294901
/* Open
C:\Users\username\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\Custom.css
and pasted this into it
*/
.even {
padding: 10px !important;
font-family: Segoe UI !important;
border-bottom: 1px solid #EEE !important;
}
View formatxml.cs
///
/// Formats the provided XML so it's indented and humanly-readable.
///
/// <param name="inputXml" />The input XML to format.
///
public static string FormatXml(string inputXml)
{
XmlDocument document = new XmlDocument();
document.Load(new StringReader(inputXml));
View mimetypeusage.cs
class Program
{
static void Main(string[] args)
{
var list = MimeType.Load();
MimeType mimetype = list.FirstOrDefault(m =&gt; m.Extension == "jpg");
}
}
View mimetypes.cs
public class MimeType
{
public string Extension { get; set; }
public string Value { get; set; }
public MimeType()
{
Extension = "";
Value = "";
}
@yetanotherchris
yetanotherchris / Install.txt.ini
Created Jul 25, 2012
Installer localization file
View Install.txt.ini
; Note: any line starting with ; is a comment!
; This file contains Roadkill Install page localization strings.
;
; Shared buttons and labels
Shared_Stage1=Welcome
Shared_Stage2=Database
Shared_Stage3=Security
Shared_Stage4=Extras
Shared_Stage5=Finished
@yetanotherchris
yetanotherchris / Site.txt.ini
Created Jul 25, 2012
Site wide strings for localization
View Site.txt.ini
; Note: any line starting with ; is a comment!
; This file contains Roadkill site-wide localization strings.
Navigation_Login=Login
Navigation_Logout=Logout
Navigation_LoggedInAs=Logged in as
Navigation_MainPage=Main Page
Navigation_Categories=Categories
Navigation_All pages=All pages
Navigation_NewPage=New page
View gist:4353209
<system.diagnostics>
<!-- Add multiple sources for varying levels of tracing -->
<sources>
<source name="debugSource" switchName="defaultSwitch" switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="ASP.NET 2.0.50727.0" />
</listeners>
</source>
</sources>
<switches>
View gist:4353243
private TraceSource _traceSource = new TraceSource("defaultSource");
public void LogInformation(string message,object params args)
{
if ((_traceSource.Switch.Level & SourceLevels.Information) == SourceLevels.Information)
{
...
}
}
You can’t perform that action at this time.