$ rails g model User
belongs_to
has_one
| import java.io.*; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.IntStream; | |
| import java.util.stream.Stream; | |
| import static java.util.stream.Collectors.toList; |
| // | |
| // Created by luka on 2.4.19.. | |
| // | |
| #ifndef GENERIC_C_GENLIST2_H | |
| #define GENERIC_C_GENLIST2_H | |
| typedef struct node { | |
| int value; | |
| struct node *next; |
| print("\n".join(["".join(["X" if abs(20 - x) + abs(20 - y) < 20 else "." for x in range(40)]) for y in range(40)])) |
| package diamond | |
| class Diamond( | |
| private val boardSize: Int, | |
| private val radius: Int, | |
| private val taken: String = "X", | |
| private val empty: String = " ", | |
| private val cellJoin: String = "", | |
| private val rowJoin: String = "\n" | |
| ) { |
| /** | |
| * Not activated users should be automatically deleted after 3 days. | |
| * <p> | |
| * This is scheduled to get fired everyday, at 01:00 (am). | |
| */ | |
| @Scheduled(cron = "0 0 1 * * ?") | |
| public void removeNotActivatedUsers() { | |
| List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(Instant.now().minus(3, ChronoUnit.DAYS)); | |
| users.forEach(user -> { |
| package com.lukaklacar; | |
| import java.util.List; | |
| import java.util.concurrent.Callable; | |
| import java.util.concurrent.ExecutorService; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.TimeUnit; | |
| import java.util.stream.Collectors; | |
| import java.util.stream.IntStream; |
| package com.lukaklacar; | |
| class Creator { | |
| <T> T createInstance(Class<T> classType) throws IllegalAccessException, InstantiationException { | |
| return classType.newInstance(); | |
| } | |
| } | |
| public class Main { |
| import re | |
| # Supported tokens and their operations | |
| ORDER_OF_OPERATIONS = ["MULTIPLY", "DIVIDE", "ADD", "SUBTRACT"] | |
| scanner = re.Scanner([ | |
| (r"([0-9]+)", lambda x, y: int(y)), | |
| (r"\+", lambda x, y: "ADD"), | |
| (r"-", lambda x, y: "SUBTRACT"), | |
| (r"\*", lambda x, y: "MULTIPLY"), | |
| (r"/", lambda x, y: "DIVIDE"), |
| /* | |
| * object.watch polyfill | |
| * | |
| * 2012-04-03 | |
| * | |
| * By Eli Grey, http://eligrey.com | |
| * Public Domain. | |
| * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
| */ |