import pandas as pd
import numpy as np
import json
import nltk
import string
import re
import tensorflow as tf
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
// Two pointers: one input, opposite ends | |
public int fn(int[] arr) { | |
int left = 0; | |
int right = arr.length - 1; | |
int ans = 0; | |
while (left < right) { | |
// do some logic here with left and right | |
if (CONDITION) { |
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
import Foundation | |
import Alamofire | |
protocol NetworkSession: class { | |
func request<T: Decodable>(router: Router, decoder: JSONDecoder, completion: @escaping (Result<T, Error>) -> Void) | |
} | |
final class APIManager: NetworkSession { | |
static let shared = APIManager() |
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
const store = require('google-play-scraper'); | |
store.reviews({ | |
appId: 'com.facebook.katana', | |
page: 1, | |
sort: gplay.sort.RECENT | |
}).then(console.log, console.log); |
import pandas as pd
import numpy as np
import json
import spacy
import nltk
import string
import re
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
appIdCondition = df['appId'].notnull() | |
dateCondition = df['date'].str.len() == 17 | |
df = df[np.logical_and(appIdCondition, dateCondition)][['appId', 'date', 'dataSource']] | |
print(df) | |
print(df.count()) | |
# Result | |
appId date dataSource | |
6 #10_Perfectly Clear 26:07:13:08:31:49 PlayStore_Random |
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
def model_cv(splits, X, y, pipeline, description, category): | |
print(description) | |
print() | |
kfold = StratifiedKFold(n_splits=splits, shuffle=True, random_state=42) | |
reports = [] | |
accuracy = [] | |
for train, test in kfold.split(X, y): | |
model_fit = pipeline.fit(X[train], y[train]) |
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
class NetworkTest: XCTestCase { | |
func testGetContacts() { | |
let expectation = self.expectation(description: "contacts") | |
var contacts: [Contact]? | |
Network.shared.request(router: Router.getContacts) { (result: Result<[Contact]>) in | |
switch result { | |
case .success(let contactList): | |
contacts = contactList |
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
class Network { | |
static let shared = Network() | |
private let config: URLSessionConfiguration | |
private let session: URLSession | |
private init() { | |
config = URLSessionConfiguration.default | |
session = URLSession(configuration: config) | |
} |
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
enum Router { | |
case getContacts | |
case getContact(id: Int) | |
case createContact(body: [String: Any]) | |
case updateContact(id: Int, body: [String: Any]) | |
private static let baseURLString = "YOUR_BASE_URL_STRING" | |
private enum HTTPMethod { | |
case get |
NewerOlder