Skip to content

Instantly share code, notes, and snippets.

View csharpforevermore's full-sized avatar
🏠
Working from home

Randle csharpforevermore

🏠
Working from home
View GitHub Profile
@csharpforevermore
csharpforevermore / web.config
Created June 6, 2015 20:33
Redirect to another domain in IIS. Can be dropped into a folder to redirect just that folder. This means you can load your resources (especially images or media) from either your live / test site - or a CDN (content delivery network). This can be particularly useful during development so you reduce the volume of your source code repository which…
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- for help, see https://technet.microsoft.com/en-us/library/cc737576.aspx -->
<httpRedirect enabled="true" destination="http://isc.dev.crumpled-dog.net$V$Q" exactDestination="true" httpResponseStatus="Temporary" />
</system.webServer>
</configuration>
@csharpforevermore
csharpforevermore / install_bower.bat
Created June 1, 2015 13:43
Set up bower once node is installed
npm install -g grunt-cli npm install bower install grunt
REM Add application to bower.json
bower install angular-ui-date --save
<label ng-repeat="fruitName in fruits">
<input
type="checkbox"
name="selectedFruits[]"
value="{{fruitName}}"
ng-checked="selection.indexOf(fruitName) > -1"
ng-click="toggleSelection(fruitName)"
> {{fruitName}}
</label>
@csharpforevermore
csharpforevermore / exception_details.ps1
Created May 30, 2015 18:52
Powershell - get current exception line number and details
$e = $_.Exception
$line = $_.InvocationInfo.ScriptLineNumber
$msg = $e.Message
Write-Host -ForegroundColor Red "caught exception: $e at $line"
Write-Host -ForegroundColor Red "An exception occurred."
Write-Host -ForegroundColor Red '$_ = ' $_
Write-Host -ForegroundColor Red '$_.GetType().FullName = ' $_.GetType().FullName
Write-Host -ForegroundColor Red '$_.Exception = ' $_.Exception
Write-Host -ForegroundColor Red '$_.Exception.GetType().FullName = ' $_.Exception.GetType().FullName
string simpleString = "this string will be cached";
HttpRuntimeCache cache = new HttpRuntimeCache();
cache.Add("simpleString", simpleString);
string fromCache = cache.Get("simpleString") as string;
cache.Remove("simpleString");
@csharpforevermore
csharpforevermore / readme.txt
Created May 28, 2015 01:47
Visual Studio solution is not hitting the breakpoint
From my previous experience please consider these :
Check you have put the break point in a right place and you are running the appropriate page or controller
Right-Click on the break point => Location => Check "Allow Source Code to be different from the original version"
If you are calling through Ajax call , Make sure you have not java-script error on the page ( for this IE catch js errors by default)
Clean solution
Rebuild
@csharpforevermore
csharpforevermore / always_delete.bat
Created May 20, 2015 10:48
Delete files and folders when Windows path is too long
mkdir empty_dir
robocopy empty_dir the_dir_to_delete /s /mir
rmdir empty_dir
rmdir the_dir_to_delete
@csharpforevermore
csharpforevermore / clicky.js
Created April 28, 2015 15:30
get element being clicked
var clicky;
$(document).mousedown(function (e) {
// The latest element clicked
clicky = $(e.target);
});
$(selector).mouseup(function (e) {
clicky = null;
});
@csharpforevermore
csharpforevermore / Example.cshtml
Created April 9, 2015 15:48
Get UmbracoApiController URL
@{
RequestContext requestContext = HttpContext.Current.Request.RequestContext;
UrlHelper urlHelper = new System.Web.Mvc.UrlHelper(requestContext);
string apiControllerUrl = urlHelper.GetUmbracoApiService<CamMonController>(x => x.CreateCampaignForNodeId(123));
}
<h1>Example Link</h1>
<a href="@(apiControllerUrl)">LINK</a>
@csharpforevermore
csharpforevermore / Category.cs
Created April 2, 2015 03:22
MVC 4 SelectList example
public class Category
{
public int ID { get; set; }
public string Name { get; set; }
}