Skip to content

Instantly share code, notes, and snippets.

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];
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']
:javascript
function initMap() {
var myLatLng = {lat: #{@user.latitude}, lng: #{@user.longitude} };
var map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
zoom: 17
});
= 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
!!!
%html
%head
%title Mapp
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
= javascript_include_tag 'application', 'data-turbolinks-track' => true
= csrf_meta_tags
%body
= yield
source 'https://rubygems.org'
gem 'simple_form', '~> 3.1.1'
gem 'bootstrap-sass', '~> 3.3.5.1'
gem 'devise', '~> 3.5.2'
gem 'haml', '~> 4.0.7'
gem 'cocoon', '~> 1.2.6'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# Use sqlite3 as the database for Active Record
class CommentsController < ApplicationController
def create
@movie = Movie.find(params[:id])
@comment = @movie.comments.new(comment_params)
@comment.user = current_user
if @comment.save
redirect_to movie_path(@movie)
else
The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
npm ERR! tar.unpack untar error /home/ricky/.npm/phantomjs/1.9.17/package.tgz
npm ERR! Linux 3.16.0-30-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "phantomjs"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path /usr/lib/node_modules/phantomjs
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/phantomjs'
ricky@ricky-VB:~$ curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 518 0 --:--:-- --:--:-- --:--:-- 522
100 22721 100 22721 0 0 21923 0 0:00:01 0:00:01 --:--:-- 41086
Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc
gpg: Signature made Mon 30 Mar 2015 05:52:13 PM EDT using RSA key ID BF04FF17
gpg: Can't check signature: public key not found
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found.