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 | |
| extension String { | |
| func safeStr(i: Int) -> String { | |
| guard i >= 0 && i < self.count else { | |
| fatalError() | |
| } | |
| return String(self[self.index(self.startIndex, offsetBy: i)]) | |
| } | |
| func safeChar(i: Int) -> Character { |
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 | |
| extension String { | |
| func safeStr(i: Int) -> String { | |
| guard i >= 0 && i < self.count else { |
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 Solution { | |
| func longestPalindrome(_ s: String) -> String { | |
| var stepper = 0 | |
| if s.count == 1 { return String(s.first!) } | |
| if s.count == 2 { | |
| if s.last == s.first { | |
| return s |
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 lengthOfLongestSubstring(_ s: String) -> Int { | |
| var cache = [Character: Int]() | |
| var tempMax = 0 | |
| var max = 0 | |
| var start = 0 | |
| for c in s.enumerated() { | |
| // check if we've seen char before |
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 Settings: Equatable { | |
| private var lastCommit: [SettingGroup] = initialSearchSettings() | |
| init(initialSettings: [SettingGroup]) { | |
| lastCommit = initialSettings | |
| resetToLastCommit() |
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 getValue<T>(forId id: String) throws -> T { | |
| for group in groups { | |
| if let value = group.getValue(forId: id) { | |
| switch value { | |
| case .enumeration(let state): | |
| if let result = state.current as? T { | |
| return result | |
| } else { |
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
| module.exports = | |
| /******/ (function(modules) { // webpackBootstrap | |
| /******/ // The module cache | |
| /******/ var installedModules = {}; | |
| /******/ | |
| /******/ // The require function | |
| /******/ function __webpack_require__(moduleId) { | |
| /******/ | |
| /******/ // Check if module is in cache | |
| /******/ if(installedModules[moduleId]) { |
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 path = require("path"); | |
| module.exports = { | |
| entry: "./src/index.js", | |
| output: { | |
| path: __dirname + "/dist/", | |
| filename: "bundle.js" | |
| }, | |
| mode: "development", | |
| module: { |
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
| { | |
| "name": "test-SC", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "build": "webpack" | |
| }, | |
| "keywords": [], |
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
| { | |
| "name": "ab-chart", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "dist/bundle.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "build": "webpack" | |
| }, | |
| "keywords": [], |