Skip to content

Instantly share code, notes, and snippets.

@cbcwebdev
cbcwebdev / StepOne.cs
Created August 15, 2011 19:25
Wizard.cs
public class StepOne
{
[Remote("Tenant", "Validation", "Api", "host", ErrorMessage = "The provided host already exists.")]
public string Host
{
get;
set;
}
public class Heirarchy<T> where T : class
{
public Heirarchy()
{
Children = new List<T>();
}
public virtual T Parent
{
get;
@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
// ----------------------------------------------------
// to cache a query do something like:
var query = Session.CreateCriteria<T>()
.Add(Expression.Eq("Id", id))
.SetCacheable(true);
<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>
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));
#pageContainerSelector ul,
#pageContainerSelector li
{
list-style: inherit;
}
#pageContainerSelector small
{
font-weight: inherit;
}
# 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();
// 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
<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']);