Skip to content

Instantly share code, notes, and snippets.

@Buildstarted
Buildstarted / WindowsAzureServiceBusQueueTest.cs
Created August 15, 2012 02:14
Testing Windows Azure Service Bus with reply queues
class WindowsAzureServiceBusQueueTest
{
private static readonly string ClientId = Guid.NewGuid().ToString("N");
private TokenProvider _credentials;
private NamespaceManager _namespaceClient;
private MessagingFactory _factory;
static void Main(string[] args)
@Buildstarted
Buildstarted / ravenhq.com.parrot
Created August 16, 2012 16:04
a webpage converted to the parrot syntax
html {
head {
meta[charset="utf-8"]
meta[name="viewport" content="width=device-width"]
title > "RavenHQ - Home"
meta[http-equiv="Content-type" content="text/html; charset=utf-8"]
meta[name="google" content="notranslate"]
link[rel="shortcut icon" href="/Content/images/favicon0.ico"]
link[rel="stylesheet" href="/Content/css/style.css" type="text/css" media="all"]
script[src="/Scripts/modernizr-2.5.3.js" type="text/javascript"]
#OS junk files
[Tt]humbs.db
*.DS_Store
#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
@Buildstarted
Buildstarted / NancyDependencyResolver.cs
Created August 23, 2012 19:03
Nancy implementation for the parrot view engine
public class NancyDepdencyResolver : IDependencyResolver
{
private TinyIoCContainer _container;
private DependencyResolver _resolver;
public NancyDepdencyResolver(TinyIoCContainer container)
{
_container = container;
_resolver = new DependencyResolver();
}
@Buildstarted
Buildstarted / parrot.syntax.md
Created August 23, 2012 21:08
Upcoming blog post about the parrot syntax

Parrot syntax

  1. Creating an element
  2. Add an id or class
  3. Add an attribute
  4. Adding children
  5. Adding siblings
  6. Adding a model parameter
  7. String literals
@Buildstarted
Buildstarted / Stream.cs
Created September 5, 2012 21:54
IEnumerable wrapper that allows for peeking
public class Stream<T>
{
private IEnumerable<T> _source;
private Queue<T> _storage;
private IEnumerator<T> _enumerator;
public Stream(IEnumerable<T> source)
{
_storage = new Queue<T>();
_source = source;
@Buildstarted
Buildstarted / _loginpartial.cshtml
Created September 29, 2012 17:28
Mvc Music Store Login Partial
@if (Request.IsAuthenticated) {
<text>
Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!
@using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
@Html.AntiForgeryToken()
<a href="javascript:document.getElementById('logoutForm').submit()">Log off</a>
}
</text>
} else {
<ul>
@Buildstarted
Buildstarted / conditional.parrot
Created September 29, 2012 19:20
Possible ways to do conditionals inp parrot
conditional(condition) {
true > lots of statements
false > lots of other statements
default > "will be called when condition doesn't match anything else"
}
conditional(condition) {
a > some value
b > something else
c > blah blah
@Buildstarted
Buildstarted / _model.cs
Last active October 11, 2015 09:18
Parrot vs other view engines
new {
Header = "Parrot",
Features = new [] {
"Familiar syntax",
"Extensible output",
"Simple model binding"
}
}
@Buildstarted
Buildstarted / simplejsontest.cs
Created October 30, 2012 19:50
Some random tests for a JsonRenderer for Parrot
[Test]
public void SimpleJsonTest()
{
var model = new[] { new { Name = "Ben" } };
string source = "Users(Users) > Name > @Name";
Assert.AreEqual("{Users:[{Name:\"Ben\"}]}", Render(source, model));
}