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
| This code aims to get all the permutations of a word. | |
| e.g. If the "abc" string is received, the otuput will be ["abc", "bca", "cba", "cab", "acb", "bac"] |
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
| <parent> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-parent</artifactId> | |
| <version>1.2.7.RELEASE</version> | |
| </parent> |
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
| <dependency> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-web</artifactId> | |
| </dependency> |
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 org.springframework.boot.*; | |
| import org.springframework.boot.autoconfigure.*; | |
| import org.springframework.stereotype.*; | |
| import org.springframework.web.bind.annotation.*; | |
| @Controller | |
| @EnableAutoConfiguration | |
| public class SampleController { | |
| @RequestMapping("/") |
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
| public class Vehicle { | |
| private Engine engine; | |
| private Transmission transmission; | |
| public Vehicle(Engine engine, Transmission transmission) { | |
| this.engine = engine; | |
| this.transmission = transmission; | |
| } | |
| } |
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
| public class Vehicle { | |
| private Engine engine = new TurboEngine(); | |
| private Transmission transmission = DSGTransmission(); | |
| } |
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 Transmission: | |
| pass | |
| class Engine: | |
| pass | |
| class Vehicle: | |
| def __init__(self, engine, transmission): | |
| self.engine = engine | |
| self.transmission = transmission |
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 save_last_login(user, get_now): | |
| datetime_now = get_now() | |
| save(user, datetime_now) |
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 TextProcessor: | |
| def __init__(self, text, tokenizer_module, sanitizer_module): | |
| self.text = text | |
| self.tokenizer = tokenizer_module | |
| self.sanitizer = sanitizer_module | |
| def get_tokens(): | |
| sanitized = self.sanitizer.sanitize(self.text) | |
| tokens = self.tokenizer.tokenize(sanitized) | |
| return tokens |
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 WirelessPrinter: | |
| def __init__(ip): | |
| self.ip = ip | |
| def print_now(report): | |
| open_connection() | |
| report.prepare_for_print() | |
| # Code required to print to an actual printer | |
| close_connection() | |
OlderNewer