Files would be laid out as follows ... obviously this is a little contrived :)
grunt.js
app/
index.html
js/
foo.js
runner.js
tests/
require 'rubygems' | |
require 'capybara/dsl' | |
require 'minitest/autorun' | |
Capybara.default_driver = :selenium | |
Capybara.default_selector = :css | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end |
// a function that does too many things | |
function showPrice(row, standardPrice, discountPrice, savings, isProrated, isDeferred) { | |
var priceCol = row.find('td.price').eq(0); | |
var discountCol = row.find('td.price').eq(1); | |
var txt = ''; | |
if (!discountPrice && !standardPrice && !savings && !isProrated && !isDeferred) { | |
discountCol.html('<img src="/img/loading.gif" />'); | |
} else { |
// repetitive code! | |
function selectedLocation() { | |
var selected = document.getElementById("countyLocation").value; | |
if (selected == "Ireland") { | |
var Ireland = new google.maps.LatLng(53.527248, -8.327637); | |
map.setCenter(Ireland); | |
map.setZoom(6); | |
} |
function selectedLocation() { | |
var selected = document.getElementById("countyLocation").value; | |
if (selected == "Ireland") { | |
var Ireland = new google.maps.LatLng(53.527248, -8.327637); | |
map.setCenter(Ireland); | |
map.setZoom(6); | |
} | |
if (selected == "Clare") { |
function getSomeThings(callback) { | |
var completed = 0; | |
var people, tasks; | |
$.ajax('/data/people.json', { | |
dataType: 'json', | |
success: function(data) { | |
completed++; | |
people = data.people; | |
onFinished(); |
// repetitive code! | |
function updateDates() { | |
var startDate = $("#start-date").datepicker("getDate"); | |
$("#menu-item-1 .day").text(startDate.getDate()); | |
$("#menu-item-1 .month").text(Util.monthToText(startDate.getMonth())); | |
$("#menu-item-1 .year").text(startDate.getFullYear()); | |
var endDate = $("#end-date").datepicker("getDate"); |
Files would be laid out as follows ... obviously this is a little contrived :)
grunt.js
app/
index.html
js/
foo.js
runner.js
tests/
var five = require("../lib/johnny-five.js"), | |
board, sensor, red, green, blue, piezo; | |
board = new five.Board(); | |
board.on("ready", function() { | |
var status = new five.Led(13); | |
status.on(); | |
red = new five.Led(8); |