Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
...
...
@darrenshrwd
darrenshrwd / gist:74bc99fa95d6df493588
Created August 20, 2014 04:21
AsyncModel (helper class)
public class AsyncModel<T>
{
private readonly Func<T> _controllerCode;
public AsyncModel(Func<T> controllerCode)
{
_controllerCode = controllerCode;
}
public T Execute()
{
@{
ViewBag.Title = "Home";
}
@section AsyncBody {
@{ViewData.Model = Model.Execute();}
<p>From faster index: @Model.Text</p>
}
@darrenshrwd
darrenshrwd / faster_Controller
Last active August 29, 2015 14:05
Faster controller
private class SomeModelDemoOnly
{
public string Text { get; set; }
}
// Traditional way
public ActionResult Index()
{
Thread.Sleep(5000); // Do lots of DB and network stuff
@darrenshrwd
darrenshrwd / dabblet.css
Created June 14, 2012 04:22 — forked from LeaVerou/dabblet.css
Playing with background-attachment
/**
* Playing with background-attachment
*/
pre {
max-height: 150px;
border: 1px solid silver;
overflow: auto;
background: url('http://placekitten.com/200/200');
color: white;
@darrenshrwd
darrenshrwd / dabblet.css
Created June 14, 2012 04:16 — forked from kizu/dabblet.css
Scrolling shadows by @kizmarh
/* Scrolling shadows by @kizmarh */
html {
background: #FFF;
}
.scrollbox {
position: relative;
z-index: 1;