Skip to content

Instantly share code, notes, and snippets.

View gist:622035
<head runat="server">
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="Content/public.css" type="text/css" media="all" />
<script src="<%: Url.Content("~/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>
View gist:622037
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Mvc;
namespace Web.Areas.Public
View gist:622167
namespace Web.Areas.Public
public partial class Public : System.Web.Mvc.ViewMasterPage
protected void Page_Load(object sender, EventArgs e)
View gist:645211
@echo off
SET server.database="${server.database}"
SET repository.path="${repository.path}"
SET version.file="${file.version}"
SET version.xpath="//buildInfo/version"
SET environment="${environment}"
View gist:662906
public void UpdateAccountingYearTemplate()
using (var fixture = new FixtureInit(@"http://localhost"))
var data = new PeriodsData(fixture.Context);
var setup = fixture.Setup;
View gist:662918
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Trackyourtasks.Core.DAL.DataModel;
namespace Trackyourtasks.Core.DAL.Repositories
/// <summary>
/// Repository of Blog posts
View gist:759517
function api_test(url, type, data, callback) {
url: url,
type: type,
processData: false,
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(data),
dataType: 'json',
async: false,
View gist:1033241
namespace MyNamespace {
public static class MyHelper
public static MvcHtmlString MyHelper(this HtmlHelper helper)
return helper.AntiForgeryToken();
View gist:1128336
(wood) Watch at least one repository
(bronze) Watcher more than 10
(silver) Watcher more than 100
(gold) Watcher more than 500
(wood) Follow at least one person
(bronze) Follow more than 10 people
(silver) Follow more than 100 people
View gist:1202916
public class HostedByCheckAttribute : ActionFilterAttribute {
public override void OnActionExecuting(ActionExecutingContext filterContext) {
var postId = filterContext.ActionParameters["id"] as int;
var postsRepo = new PostsRepository();
var post = postsRepo.Get(postId);
if (!post.IsHostedBy(/* ... */)) {
filterContext.Result = new ViewResult { ViewName = "InvalidOwner", ViewBag = filterContext.Controller.ViewBag, ViewData = filterContext.Controller.ViewData };