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
| CREATE SEQUENCE id_seq; |
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
| CREATE FUNCTION fetch_id(text) RETURNS bigint AS | |
| 'select (9369712273 * nextval($1) + 1365089121) % 999999937;' | |
| LANGUAGE SQL | |
| IMMUTABLE | |
| RETURNS NULL ON NULL INPUT; |
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
| CREATE TABLE users | |
| ( | |
| id BIGINT NOT NULL DEFAULT fetch_id('id_seq'), | |
| email VARCHAR | |
| ); |
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
| INSERT INTO users (email) VALUES ('[email protected]'); | |
| INSERT INTO users (email) VALUES ('[email protected]'); | |
| INSERT INTO users (email) VALUES ('[email protected]'); | |
| SELECT * FROM USERS; | |
| id | email | |
| -----------+------------------- | |
| 734802024 | [email protected] | |
| 104514927 | [email protected] | |
| 474227767 | [email protected] |
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
| var timestamp = (new Date()).getTime(); | |
| var username = 'user-' + timestamp; | |
| var users = localStorage.getItem("users"); | |
| if (users) { | |
| users = users + "," + username; | |
| } else { | |
| users = username; | |
| } |
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
| var users = localStorage.getItem("users"); | |
| if (users) { | |
| username = users.split(",").slice(-1)[0]; | |
| document.getElementById('username').value = username; | |
| document.getElementById('password').value = 'testing123'; | |
| document.getElementById('submitButton').focus(); | |
| } |
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
| var users = localStorage.getItem("users"); | |
| if (users) { | |
| users = users.split(","); | |
| } else { | |
| users = "no users stored"; | |
| } | |
| console.log(users); |
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
| localStorage.removeItem("users"); |
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 UsersCreator | |
| def create(attributes) | |
| user = UserRepository.new.create(attributes) | |
| if user.nil? || !user.persisted? | |
| return user | |
| end | |
| notification_success = UserNotifier.new(user).send_signup_confirmation | |
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 UsersCreator | |
| def create(attributes) | |
| repository_response = UserRepository.new.create(attributes) | |
| return repository_response unless repository_response.success | |
| user = repository_response.entity | |
| notifier_response = UserNotifier.new(user).send_signup_confirmation | |
| ServiceResponse.new( | |
| success: notifier_response.success, |