Skip to content

Instantly share code, notes, and snippets.

Avatar

Rob "Hurricane" Ashton robashton

View GitHub Profile
@robashton
robashton / test.cs
Created Feb 17, 2013
What my use of mocking frameworks looks like in C# vs JavaScript
View test.cs
// CSharp
@robashton
robashton / dynamic-query.cs
Created Feb 14, 2013
I'm quite pleased with this new feature
View dynamic-query.cs
var ordersForCustomer = session.Query<Order>()
.Where(order => order.CustomerId == "customers/bob")
.TransformWith<OrderWithProductInformation, OrderWithProductInformation.Result>()
.List();
View original.md

If you ask most professional developers (as compared to a Hobbyist, see "What's the Difference between a Hobbyist and a Professional") about JavaScript and you'll likely get non-positive responses. Most professional developers – that is those that get paid – don't like JavaScript because it's hard to make a craft of developing when you're limited by your language. Most professional developers have come to expect a set of tools to help them develop more reliable code and to create the code faster in the first place. JavaScript isn't bad for tying a few loose things together, however, developing enterprise scale applications is not what it was designed for.

@robashton
robashton / index.html
Created Oct 28, 2012
Push-based dom templating with cheerio
View index.html
<h1></h1>
<section>
<div class="hotel">
<h5 class="hotel-name"></h5>
<p class="hotel-description"></p>
</div>
</section>
<!-- Trying to use the HTML elements themselves as selectors will lead to pain because the designer should be able to change that crap and you shouldn't have to worry which elements they've used, classes/ids are saner -->
View gist:3879435
package samples
import kspec.framework.*
spec public fun calculatorSpecs() {
var calculator = null
var sum = 0
given("a calculator", {
calculator = Calculator()
View ConsoleSpinner.cs
static void Main(string[] args)
{
ConsoleSpinner spin = new ConsoleSpinner();
Console.Write("Working....");
while (true)
{
spin.Turn();
}
}
@robashton
robashton / curry.md
Created Oct 10, 2012
Curry on Friday Night
View curry.md
View gist:3609294
var Browser = require('zombie')
, client = new Browser()
client.visit('http://localhost', function() {
client.fill('title', 'This is an awesome blog entry')
client.click('submit')
})
View gist:3011019
(defn onKeyDown [e]
(.log js/console "down")
)
(defn onKeyUp [e]
(.log js/console "up")
)
(defn hookKeyboard []
(.addEventListener js/document "keydown" onKeyDown)
View gist:3010659
Scenario "Bootstrapping the game", ->
context = new ManualContext()
bob = null
alice = null
Given "a server in a ready state", (done) ->
context.start(done)
When "bob connects", (cb) ->
bob = context.add_client_called 'bob', cb
Then "bob should have a canvas displayed", ->