Skip to content

Instantly share code, notes, and snippets.

@hgarcia
hgarcia / steps.rb
Created September 2, 2010 02:48
Pickle cucumber steps not recognized
@wipScenario: Assign roles Given the following roles exist
| name |
| admin |
| reader |
| publisher |
When I am on the roles page
Then I should see "admin"
And I should see "reader"
And I should see "publisher"
@hgarcia
hgarcia / file0.cs
Created September 2, 2010 04:18
2007-12-08-a-rest-api-in-20-minutes---part-1.textile
using System;
using System.Web;
namespace LaTrompa.Services
{
public interface IServiceable
{
void Process(HttpContext context);
}
@hgarcia
hgarcia / file0.cs
Created September 2, 2010 04:18
2007-12-08-a-rest-api-in-20-minutes---part-2.textile
using System;
using System.Web;
namespace LaTrompa.Services
{
public class ServiceHandlerFactory
{
public static IServiceable Create(UriProcessor up)
{
@hgarcia
hgarcia / file0.aspx-cs
Created September 2, 2010 04:18
2007-12-23-using-an-existing-model-with-the-asp-mvc-framework.textile
using System;
using System.Web;
using System.Web.Mvc;
using LaTrompa.Dal;
using MyGeneration.dOOdads;
namespace MvcDemo2.Controllers
{
public class MovieController : Controller
@hgarcia
hgarcia / file0.aspx-cs
Created September 2, 2010 04:18
2007-12-23-using-microsoft-asp-net-mvc-with-doodads.textile
<ul>
<li><a runat="server" href="~/">Home</a></li>
<li><%= Html.ActionLink("Movies", "List", "Movie") %></li>
<li><%= Html.ActionLink("About Us", "About", "Home") %></li>
</ul>
@hgarcia
hgarcia / file0.aspx-cs
Created September 2, 2010 04:18
2007-12-25-linq-to-search-arrays-and-auto-implemented-properties-.textile
public class Person
{
public string FirstName;
public string LastName;
public int Age;
}
@hgarcia
hgarcia / file0.js
Created September 2, 2010 04:18
2007-12-25-the-same-template-in-the-client-and-server-side-.textile
var templateString = "<div class=\"movieContainer\">\n<h4 class=\"movieTitle\">#{title}</h4>\n";
templateString += "<img src=\"#{dvdCover}\" class=\"movieCover\" alt=\"#{title}\" />\n";
templateString += "<p>#{description}</p>\n</div>\n";
// the template (our formatting expression)
var myTemplate = new Template(templateString);
// our data to be formatted by the template
var show = {title: 'The Simpsons', description: 'Create by Matt Groening', dvdCover: 'images/simpsons.jpg' };
@hgarcia
hgarcia / file0.aspx-cs
Created September 2, 2010 04:18
2007-12-28--net-simple-templating-system-(2).textile
var template = "Hello #{member.name} our records indicate that you purchased the book: #{member.purchases.details.line1}.";
@hgarcia
hgarcia / file0.js
Created September 2, 2010 04:18
2007-12-31-implementing-the-each-method-in-c-sharp-collections.textile
['one', 'two','three'].each(function(s) {
alert(s);
});
//or even better
['one','two','three'].each(doSomething);
function doSomething(s){
if (s === 'one'){
alert('The first element').
@hgarcia
hgarcia / file0.aspx-cs
Created September 2, 2010 04:18
2008-01-04-extending-the-string-object-in-c-sharp.textile
public static string ToCamel(this string value)
{
var s = value;
s = s.Trim().ToLower();
if (s.Length == 0)
{
return value;
}