Skip to content

Instantly share code, notes, and snippets.

= link_to "Home", root_url
%h1= @user.name
%h2 nearby cities
- for name in @user.nearbys(25)
%li
= link_to name.name, @user
= name.distance.round(2)
miles
:javascript
function initMap() {
var myLatLng = {lat: #{@user.latitude}, lng: #{@user.longitude} };
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
zoom: 17
});
Test Results:
String.prototype.toAlternatingCase
should work for fixed tests (provided in the description)
✘ Expected: 'HELLO WORLD', instead got: ['H', 'E', 'L', 'L', 'O', ' ', 'W', 'O', 'R', 'L', 'D']
✘ Expected: 'hello world', instead got: ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
✘ Expected: 'HELLO world', instead got: ['H', 'E', 'L', 'L', 'O', ' ', 'w', 'o', 'r', 'l', 'd']
✘ Expected: 'hEllO wOrld', instead got: ['h', 'E', 'l', 'l', 'O', ' ', 'w', 'O', 'r', 'l', 'd']
✘ Expected: '12345', instead got: ['1', '2', '3', '4', '5']
✘ Expected: '1A2B3C4D5E', instead got: ['1', 'A', '2', 'B', '3', 'C', '4', 'D', '5', 'E']
✘ Expected: 'sTRING.PROTOTYPE.TOaLTERNATINGcASE', instead got: ['s', 'T', 'R', 'I', 'N', 'G', '.', 'P', 'R', 'O', 'T', 'O', 'T', 'Y', 'P', 'E', '.', 'T', 'O', 'a', 'L', 'T', 'E', 'R', 'N', 'A', 'T', 'I', 'N', 'G', 'c', 'A', 'S', 'E']
describe("Example tests", function(){
var testData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15];
var actual = countPositivesSumNegatives(testData);
var expected = [10, -65];
Test.expect(actual[0] == expected[0] && actual[1] == expected[1], "Wrong return value.");
testData = [0, 2, 3, 0, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14];
actual = countPositivesSumNegatives(testData);
expected = [8, -50];