Skip to content

Instantly share code, notes, and snippets.

@gardym
gardym / gist:1183229
Created August 31, 2011 10:06
Span vs Label: Round 1!
<p>
<span>First Name</span>
<input type="text" name="first_name" />
</p>
<p>
<label for="surname">Surname</label>
<input type="text" name="surname" />
</p>
IWebDriver driver = new FirefoxDriver();
label = driver.FindElement(By.Css(@"label:contains(\"Surname\")");
input = driver.FindElement(By.Name(label.GetAttribute("for"));
input.SendKeys("Shnoop");
@gardym
gardym / gist:1183575
Created August 31, 2011 13:49
Gherkin with for
Given I have a new application form
When I enter "Shnoops" into the input named "textbox_surname"
And I click "Save"
...
Given I have a new application form
When I enter "Shnoops" into the box for "Surname"
And I click "Save"
....
@gardym
gardym / IEnumerableLambdaDistinct
Created October 18, 2011 05:32
.NET Linq Extension: Use a lambda for Distinct() quality comparison
public static class IEnumerableExtensions
{
public static IEnumerable<T> Distinct<T>(this IEnumerable<T> enumerable, Func<T, T, bool> comparison)
{
return enumerable.Distinct(new LambdaEqualityComparison<T>(comparison));
}
internal class LambdaEqualityComparison<T> : IEqualityComparer<T>
{
private readonly Func<T, T, bool> comparison;
@gardym
gardym / jQuery.times.js
Created March 14, 2012 00:30
jQuery: $.times
(function($) {
$.times = function(x, f) {
for(var i = 0; i < x; i ++) {
f(i);
}
};
})($);
@gardym
gardym / 90-heroku.conf
Created April 26, 2012 02:40
rsyslog.d/90-heroku.conf for capturing Heroku drains
:syslogtag, contains, "app[web.1]" /var/log/heroku/web.1.log
:syslogtag, contains, "app[web.2]" /var/log/heroku/web.2.log
:syslogtag, contains, "app[web.3]" /var/log/heroku/web.3.log
:syslogtag, contains, "app[web.4]" /var/log/heroku/web.4.log
:syslogtag, contains, "heroku[router]" /var/log/heroku/router.log
:syslogtag, contains, "run" /var/log/heroku/run.log
:inputname, isequal, "imtcp" /var/log/heroku/all.log
@gardym
gardym / heroku
Created April 26, 2012 04:18
logrotate.d/heroku - Rotate heroku log files. Execute this hourly via cron (cron.hourly)
create
compress
/var/log/heroku/*.log
{
# Keep logs for ten days
rotate 240
# Always rotate
size 1
missingok
@gardym
gardym / foo.js
Created July 14, 2012 05:40
RequireJS/Jasmine-node
define(function() {
return {
bar: function() {
return "bar";
}
};
});
@gardym
gardym / baz.js
Created July 14, 2012 05:46
Foo, bar, baz, qux - RequireJS/Jasmine-node
define(function() {
return {
qux: function() {
return "qux";
}
};
});

In improve this we take a look at a reader submitted test, user interface, story or block of code and we try and improve it, without context, explaining what we did as we went.

In this issue, Mike sent a link to an [event source to a realtime social media visualization][source].

Before we ever apply brainpower, let's apply computer power. [JSLint][] and [JSHint][] are both tools to find mistakes and oversights.