This file contains 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
import XCTest | |
import Hamcrest | |
import FutureKit | |
@testable import FruitApp | |
class ListOfFruitsViewControllerTest: XCTestCase { | |
... | |
func testShowsFruitDetailsWhenFruitRowIsTapped() { |
This file contains 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
import XCTest | |
import Hamcrest | |
import FutureKit | |
@testable import MyExampleApp | |
class ExampleViewControllerTest: XCTestCase { | |
var fakeExampleService: FakeExampleService! | |
override func setUp() { |
This file contains 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
import XCTest | |
import Hamcrest | |
import FutureKit | |
@testable import MyExampleApp | |
class ExampleViewControllerTest: XCTestCase { | |
... | |
This file contains 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
@Configuration | |
@EnableBatchProcessing | |
public class XmlParsingApplication { | |
@Bean | |
public StaxEventItemReader itemReader() throws Exception { | |
StaxEventItemReader reader = new StaxEventItemReader<>(); | |
reader.setName("birthday"); | |
reader.setResource(new ClassPathResource("all_members.xml")); |
This file contains 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
import FutureKit | |
import SwiftyJSON | |
class VillainService { | |
let url: String | |
var session: URLSession = URLSession.shared | |
func getVillainList() -> Future<VillainResponse> { | |
let promise = Promise<VillainResponse>() | |
This file contains 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
import XCTest | |
import Nimble | |
import SwiftyJSON | |
import FutureKit | |
@testable import VillainApp | |
class VillainServiceTest: XCTestCase { | |
var service: VillainService! |
This file contains 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
class MockSession: URLSession { | |
var completionHandler: ((Data?, URLResponse?, Error?) -> Void)? | |
var request: URLRequest? | |
let stubbedDataTask: MockURLSessionDataTask = MockURLSessionDataTask() | |
override func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask { | |
self.completionHandler = completionHandler | |
self.request = request | |
return stubbedDataTask |
This file contains 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
import FutureKit | |
import UIKit | |
class VillainsMasterViewController: UIViewController { | |
let villainService: VillainService? | |
... | |
func viewDidLoad() { | |
villainService?.getVillainList() |
This file contains 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
class LinearRegressor(Object): | |
def gradient_descent(self, x, y, alpha, max_iterations): | |
num_rows = x.shape[1] + 1 | |
w = np.array([random.random() for item in range(num_rows)]).reshape(num_rows,1) | |
best_weights = [] | |
lowest_cost = None | |
iter = 1 |
This file contains 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
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import autograd.numpy as np # Thinly-wrapped numpy | |
from autograd import grad as compute_grad # The only autograd function you may ever need | |
class learner(): | |
def __init__(self,**args): |