This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'minitest/autorun' | |
| # Test case provided by: http://en.wikipedia.org/wiki/Standard_deviation | |
| class TestStandardDeviation < MiniTest::Unit::TestCase | |
| def setup | |
| @values = [2, 4, 4, 4, 5, 5, 7, 9] | |
| end | |
| def test_average_is_calculated | |
| average = @values.inject{ |memo, element| memo + element} / @values.length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'minitest/autorun' | |
| require 'date' | |
| class TestWeekdayCounter < MiniTest::Unit::TestCase | |
| def test_number_of_tuesdays_in_june_2014_should_be_4 | |
| thisMonth = Date.new(2014, 6, 1) | |
| nextMonth = Date.new(2014, thisMonth.month + 1, 1) - 1 | |
| assert_equal 4, WeekdayCounter.new.get_tuesdays(thisMonth, nextMonth) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'minitest/autorun' | |
| class TestDeck < MiniTest::Unit::TestCase | |
| def test_that_deck_has_52_cards | |
| deck = Deck.new | |
| assert_equal 52, deck.cards.count | |
| end | |
| def test_that_deck_is_shuffled |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Firebase = require('firebase'); | |
| var json2html = require('node-json2html'); | |
| const api = new Firebase('https://hacker-news.firebaseio.com/v0') | |
| var topStoryIds = [] | |
| function loadTopStories(callback) { | |
| api.child('topstories').on('value', snapshot => { | |
| topStoryIds = snapshot.val(); | |
| callback(print_stories); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| namespace UnitTestProject1 | |
| { | |
| [TestClass] | |
| public class UnitTest1 | |
| { | |
| [TestMethod] | |
| public void ShouldEncodeIntegerToBase58() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| using System.Collections.Generic; | |
| namespace UnitTestProject1 | |
| { | |
| [TestClass] | |
| public class UrlRepositoryTest | |
| { | |
| [TestMethod] | |
| public void ShouldAddKeyAndRetrieveKey() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func buildIndexFromNames(names: [String]) -> [String:[String]] { | |
| var indexedNames: [String:[String]] = [String():[]] | |
| for name in names{ | |
| let firstLetterOfString = String(name.characters.prefix(1)).uppercaseString | |
| if indexedNames[firstLetterOfString] != nil { | |
| indexedNames[firstLetterOfString]!.append(name) | |
| } else { | |
| indexedNames[firstLetterOfString] = [name] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func setupLoadingIndicator() { | |
| indicator.color = UIColor .blackColor() | |
| indicator.frame = CGRectMake(0.0, 0.0, 10.0, 10.0) | |
| indicator.center = self.view.center | |
| self.view.addSubview(indicator) | |
| indicator.bringSubviewToFront(self.view) | |
| indicator.startAnimating() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func loadTable() { | |
| dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { | |
| //Add your long running task to get the table data here | |
| dispatch_async(dispatch_get_main_queue()) { | |
| self.indicator.stopAnimating() | |
| self.indicator.hidesWhenStopped = true | |
| self.tableView.reloadData() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Border of Polygon | |
| -115.103760,50.958427,0.0 | |
| -115.982666,51.103522,0.0 | |
| -116.290283,51.323747,0.0 | |
| -116.323242,51.563412,0.0 | |
| -115.982666,51.638476,0.0 | |
| -115.576172,51.549751,0.0 | |
| -114.895020,51.337476,0.0 | |
| -114.763184,51.013755,0.0 | |
| -115.081787,50.958427,0.0 |