This file contains 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 Customers | |
{ | |
[Key] | |
[DatabaseGenerated(DatabaseGeneratedOption.None)] | |
public long Sessionid { get; set; } | |
public long? Pers { get; set; } | |
} |
This file contains 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.Net; | |
public class WebDownload : WebClient | |
{ | |
/// <summary> | |
/// Time in milliseconds | |
/// </summary> | |
public int Timeout { get; set; } | |
This file contains 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
protected string GetIPAddress() | |
{ | |
System.Web.HttpContext context = System.Web.HttpContext.Current; | |
string ipAddress = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; | |
if (!string.IsNullOrEmpty(ipAddress)) | |
{ | |
string[] addresses = ipAddress.Split(','); | |
if (addresses.Length != 0) | |
{ |
This file contains 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
// Vanilla JavaScript - trim Leading and Trailing - ES5 | |
function TrimVanilla(str){ | |
return str.trim(); | |
} | |
// Older browsers - IE8 and before - using Polyfill. Call trim() method after running this. | |
function TrimPolyfill(){ | |
if (!String.prototype.trim) { | |
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/g, ''); |
This file contains 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
@{ | |
var multiUrlPicker = Model.Content.GetPropertyValue<MultiUrls>("multiUrlPicker"); | |
if (multiUrlPicker.Any()) | |
{ | |
<ul> | |
@foreach (var item in multiUrlPicker) | |
{ | |
<li><a href="@item.Url" target="@item.Target">@item.Name</a></li> | |
} | |
</ul> |
This file contains 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
Here are all the classes from Bootstrap 3 (version 3.1.1). | |
Method of extraction: | |
1. Download Bootstrap 3 and rename bootstrap.css as "bootstrap.html" | |
2. Add the following 24 lines of code to the very bottom of the bootstrap.html file: | |
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script> | |
<script> |
This file contains 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
$(window).load(function() { | |
$('img').error(function () { | |
var width = $(this).width(); | |
var height = $(this).height(); | |
if ((width > 0) && (height > 0)) { | |
$(this).attr('src', '//placehold.it/' + width + 'x' + height); | |
// Or, hide them | |
// $(this).hide(); | |
} | |
}); |
This file contains 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 HomeController : Controller | |
{ | |
// | |
// GET: /Home/ | |
public ActionResult Index() | |
{ | |
return View(); | |
} | |
protected override void HandleUnknownAction(string actionName) |
This file contains 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 Umbraco.Core.Models; | |
@using Umbraco.Core.Services; | |
var contentTypeService = ApplicationContext.Current.Services.ContentTypeService; | |
var contentType = contentTypeService.GetContentType(4200); | |
contentType.ParentId=3130; | |
contentTypeService.Save(contentType); |