Skip to content

Instantly share code, notes, and snippets.

View JeffryGonzalez's full-sized avatar

Jeffry Gonzalez JeffryGonzalez

View GitHub Profile
require 'haml'
def codify (file_name, caption)
source = IO.read "code/#{file_name}.txt"
haml_tag :div, :class=>"figure" do
haml_tag :span, :class=>"caption" do
haml_concat "#{caption} (#{file_name}.cs)"
end
haml_concat preserve(source)
end
rule ".txt" => ".cs" do |t|
puts "Creating #{t.name} from #{t.source}"
sh "uv #{t.source} > #{t.name} -t idle"
end
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Routing;
namespace MvcHelpers
{
public class HttpVerbConstraint : IRouteConstraint
{
public const string XHTTPMethodOverride = "X-HTTP-Method-Override";
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using VideoStore.Domain;
using VideoStore.Contracts;
using System.ServiceModel.Description;
namespace VideoStore.Host
public static void Unlock(bool isDigiLock)
{
KeyLock regularLock = new KeyLock();
DigiLock modernLock = new DigiLock();
if(isDigiLock)
{
modernLock.Unlock();
}
else
{
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Index</title>
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace VideoStore.Domain
{
public class MediaLookup
{
private IDictionary<int, Media> items = new Dictionary<int, Media>
@JeffryGonzalez
JeffryGonzalez / restroutes.cs
Created August 31, 2011 15:01
Restful Routes MVC3
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Destroy",
"{controller}/{id}",
new { action = "Destroy" },
new { id=@"\d+", httpMethod = new RestHttpMethodConstraint("DELETE") }
);
routes.MapRoute(
@JeffryGonzalez
JeffryGonzalez / rowfixture.htm
Created September 21, 2011 18:53
rowfixture
<html>
<head>
</head>
<body >
<div >
@JeffryGonzalez
JeffryGonzalez / HttpVerbConstraint.cs
Created October 12, 2011 15:47
Method Constraint
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
namespace Monday.Models
{
public class HttpVerbConstraint : IRouteConstraint
{