Skip to content

Instantly share code, notes, and snippets.

View jguadagno's full-sized avatar

Joseph Guadagno jguadagno

View GitHub Profile
@jguadagno
jguadagno / GooglePlusOneExtension-constructor.cs
Created April 27, 2018 15:52
Add Google Plus One Extension to BlogEngine.NET
public GooglePlusOne()
{
InitializeSettings();
Post.Serving += ServingHandler;
Page.Serving += ServingHandler;
}
@jguadagno
jguadagno / GooglePlusOneExtension-serving-handler.cs
Created April 27, 2018 15:54
Add Google Plus One Extension to BlogEngine.NET
void ServingHandler(object sender, ServingEventArgs e)
{
if (!ExtensionManager.ExtensionEnabled(ExtensionName)) return;
if (e.Location == ServingLocation.Feed) return;
HttpContext context = HttpContext.Current;
if (context != null)
{
System.Web.UI.Page page = context.CurrentHandler as System.Web.UI.Page;
if (page != null)
@jguadagno
jguadagno / GooglePlusOneExtension-script-inject.cs
Created April 27, 2018 15:56
Add Google Plus One Extension to BlogEngine.NET
public static void ScriptInject(System.Web.UI.Page page)
{
HtmlGenericControl googleScript = new HtmlGenericControl("script");
googleScript.Attributes["type"] = "text/javascript";
googleScript.Attributes["src"] = "https://apis.google.com/js/plusone.js";
page.Header.Controls.Add(googleScript);
}
@jguadagno
jguadagno / GooglePlusOneExtension-get-button.cs
Last active April 27, 2018 18:38
Add Google Plus One Extension to BlogEngine.NET
public static string GetButton(string url)
{
string size = ExtensionSettings.GetSingleValue("size") = "standard";
string googlebutton = string.Format("<g:plusone size='{0}' href='{1}'></g:plusone>", size, url);
return googlebutton;
}
@jguadagno
jguadagno / DebuggerDisplayAttribute-person.cs
Last active April 27, 2018 19:26
DebuggerDisplay Attribute
public class Person
{
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string FullName
{
get
{
return string.Format("{0} {1}{2}",
@jguadagno
jguadagno / DebuggerDisplayAttribute-attribute.cs
Created April 27, 2018 18:43
DebuggerDisplay Attribute - Attribute
[DebuggerDisplay("FirstName={FirstName} LastName={LastName}")]
@jguadagno
jguadagno / DebuggerDisplayAttribute-person-complete.cs
Last active April 27, 2018 18:48
DebuggerDisplay Attribute - Person Complete
[DebuggerDisplay("FirstName={FirstName} LastName={LastName}")]
public class Person
{
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
public string FullName
{
get
{
@jguadagno
jguadagno / DataRepeaterItemTemplate-intro.html
Created April 27, 2018 19:34
DataRepeater ItemTemplate
<ul data-role="listview" data-inset="true" data-theme="d" data-filter="true">
<li data-role="list-divider">2/25/2012<span id="EventCount_0" class="ui-li-count">1</span></li>
<li>
<a href="/m/e.aspx?Id=45">
<h3><span>Northwest Harvest at MVP Summit 2012</span></h3>
<p><strong><span>Northwest Harvest Warehouse</span></strong></p>
<p class="ui-li-aside"><span>from 11:30 AM to 5:00 PM</span></p>
</a>
</li>
<li data-role="list-divider">2/27/2012<span class="ui-li-count">2</span></li>
@jguadagno
jguadagno / DataRepeaterItemTemplate-attributes.html
Created April 27, 2018 19:36
DataRepeaterItem ItemTemplate
<ul data-role="listview" data-inset="true" data-theme="b" data-filter="true">
<li>
<a href="/m/e.aspx?Id=45">
<h3><span>Northwest Harvest at MVP Summit 2012</span></h3>
<p><strong><span>Northwest Harvest Warehouse</span></strong></p>
<p class="ui-li-aside"><span>from 11:30 AM to 5:00 PM</span></p>
</a>
</li>