Skip to content

Instantly share code, notes, and snippets.

public class Directory : Entity
{
protected Directory()
{
Listings = new HashedSet<DirectoryListing>();
Features = new HashedSet<IFeature>();
}
public Directory(DirectoryContext context)
{
<script type="text/javascript">
// protect against multiple google analytics instances
var _gaq = _gaq || [];
// inform google whose account is being used
_gaq.push(['_setAccount', 'UA-27464642-1']);
// inform google to track a pageview on this page
_gaq.push(['_trackPageview']);
// say this is the "button" click that makes the iframe fullscreen
$('button.fullscreen').click(function() {
// fetch existing iframe
var $iframe = $('#iframeId');
// clone iframe to push it into a new content area
var $iframeInstance = $iframe.clone();
// add clone to body
# HTML
# <iframe id="website-container" src="http://example.com"></iframe>
// ...
// set iframe src on click event
// ...
// does this get a value?
var height = $('#website-container > html > body').height();
#pageContainerSelector ul,
#pageContainerSelector li
{
list-style: inherit;
}
#pageContainerSelector small
{
font-weight: inherit;
}
public IList<Location> NearbyLocations(decimal latitude, decimal longitude, int distance, int excludeLocationId)
{
var criteria = Session.CreateSQLQuery("exec NearbyLocations @Latitude=:latitude, @Longitude=:longitude, @Distance=:distance, @ExcludeId=:excludeid");
criteria.SetDecimal("latitude", latitude);
criteria.SetDecimal("longitude", longitude);
criteria.SetInt32("distance", distance);
criteria.SetInt32("excludeid", excludeLocationId);
criteria.AddEntity(typeof (Location));
<section class="grid_8">
@using (Html.BeginForm("create", "promotion", FormMethod.Post, new { @class = "form" }))
{
<fieldset>
<p>
@Html.LabelFor(x => x.Title)
@Html.TextBoxFor(x => x.Title, new { @class = "liquid" })
@Html.ValidationMessageFor(x => x.Title)
</p>
<p>
// to cache a query do something like:
var query = Session.CreateCriteria<T>()
.Add(Expression.Eq("Id", id))
.SetCacheable(true);
@cbcwebdev
cbcwebdev / gist:1217302
Created September 14, 2011 18:13
Keeping track of published messages
protected void Button_Click(object sender, EventArgs e)
{
// give the message a unique identifier (guid?)
var message = new SomeActionMessage();
// ----------------------------------------------------
// I'm adding my messages to a queue with 2 properties
// The current time, and the ID of the message
// ----------------------------------------------------
public class Heirarchy<T> where T : class
{
public Heirarchy()
{
Children = new List<T>();
}
public virtual T Parent
{
get;