Flask is a wonderful Python microframework for server-side web development.

I haven't used Flask for a year or so, outside of the horrifying, grindy refactoring I've been doing at work, so I decided to hack together a little Tumblr clone. Overall, this thing took me about two days to complete.

This was also a great chance to brush up on using the SQLAlchemy ORM, as well as learning a few Flask extensions I want to use in some future projects (Flask-Login, Flask-Assets), and some fun features of Jinja2 that I'd never used before.

Since this is a random side-project, I didn't use a heavy CSS framework, but just hacked up the CSS on-the-fly; I think that gave the UI a nice early-to-mid 2000s feel.

Added a database library just to connect and manage database tasks (for SQLite3) and created a .sql script to create the empty database on installation/update.

About 1'5h expent into this, closing the deadline!

Well. maybe I'm failing somewhat to the weird stuff to more experienced programmers, but in my environment seems pretty weird that I'm spending time to learn to automate tests in the browser with things like puppeteer.

So, now, behold!

My first steps on testing in headless browsers! :-D

https://gist.github.com/tzkmx/441ddf10df8adbb5abbc433775fb86c0

Hey, it's my first post here so I will give a little bit of context. I'm building a web platform using lapis(My first time using lapis) , to allow people to look for jobs.

Today code:

  • Today I refactored my forms implementation to use a base template instead of having a different etlua file for each form.
  • Added a new login form.
  • Checked the available configuration parameters of lapis and did a configuration for development with performance benchmarking and another for production with cache and more secure configurations.
  • Started learning and testing the lapis database query interface and the database schema so I can build the data model.

Today I implemented the back end for a university forum.

  • Implemented management of questions and answer.
  • Created models with course, semester, discipline, forum, questions and answers.
  • Created tree with the data so it can be displayed as menus in the front end.
  • Create an api to manage this system.
  • Created unit tests using the django fixtures so I can use the whole db as a mock for my unit tests (Just found about it, it's super nice :D ).

Finished the university forum initial backend.

  • Added logic to manage the voting in answers of questions.
  • Add unit tests to validate that logic.
  • Added login and logout logic.

Checked projects code from leafo and Karai17 looking for lapis good practices.
Planed all the database needed for the application and created a migrations file in lua for lapis to generate the initial database.
Generated the database schema with the lapis migrations command.

Added new field for the job searching in the existing pages.
Started a new page to look for jobs by selecting the main categories icons.
Still in early stages :p (Usually I use bootstrap, but this time I'm trying materializecss )

I saw some guy on the internet who said that minesweeper was the easiest game to build that people will like very much.
So today I started making a minesweeper using Love2D and lua.
Already have some sprites, drawing of the map, drawing of pressed tiles, drawing of mines, flagged tiles, triggers to press the tiles and to put the flags when clicking with the mouse.
I'm starting now making the calculations for the neighborhood.

Added neighborhood calculations to display the numbers of mines in each cell.
Added red mark when selecting a mine, display all the other mines and present a you lost text.
Added expansion of the cells when clicking a cell with zero mines nearby.
Added specific colours for each of the numbers in the cells.

Today I finished all the core of the game:

  • Added hidding of mines already flagged when the player loses.
  • Added detection of winning and display a 'You Won' text.
  • Added release of the old map system references when the game is restarted.
  • Added set of the window size according to the grid size so the game looks good for any grid size.
  • Added scalling of the font instead of scalling each print, so we got well defined strings printed.

Now that the base of the game is done, next days I will be focusing in usability and features to improve the gameplay.

Today I made a bit more of the job search platform:

  • Added materializecss typeahaed search bar to the job search dashboard.
  • Added autofill of the search field in the job search list using the url parameters.
  • Refactor in the dashboard to be more beautifull and more responsive in mobile.

Today I added prefill of the table search by using the search bar and multiple categories data.
Changed a bit the layout of a dashboard.

Reminder

I tried some simple notes apps, but they always occupied too much of my visual monitor space, and didn't let me search older stuff easily. So today I built a simple reminder script to take notes and easily search them later. Full command line so I can grep my notes by full text search super easy.

Calendar

I forget too many events, like birthdays, meetings, etc, so I started making a calendar which can prompt notifications in my desktop and maybe later send me emails. For the calendar I made a script to generate the events, which will ask for a date and a description. If all the formatting is correct it will save it.
I made another script which will check the next 5 days from the current day and generate a desktop notification for each event using the zenity tool and made a desktop file to trigger the script when the pc boots and the graphical environment starts.

  • Added lapis CSRF generation and validation when receiveing the requests.
  • Added CSRF fields in the main form models and in some of the etlua templates.
  • Changed project structure to have controller and helpers instead of having all the logic in the app.lua file.

Tasks done today:

  • Changed CSRF validation to use the assert_token instead of directly calling the validate_token.
  • Added redirection of the users that are already logged to the index page if they try to access the login page.
  • Started translation of the form fields to the values needed for the lapis input validation, so forms allow direct render, front-end validation and back-end validation by using just their table of datafields

Today I made a Entity Component System base skeleton in lua to understand how it works.
The objective with this is to migrate the minesweeper I built two week ago to this architecture, and see if its so good as people suggest.
I already saw multiple really nice possibilities with this architecture, but lets only take conclusions after having something concrete implemented in it.

Today I created systems to render the minesweeper map blocks and detect the clicking in them.
I created the main components Block, Rect and Point.
Generated an entity called map_block to hold the 3 components.

This allows me already to have all the map rendering and triggering of the input state changes for each of the blocks.

The ECS is being a nice experiment, I can apply the logic in a more focused way to the components, which allows me to have an easier time when splitting responsibilities in the code.

I'm still checking out how to make interaction between multiple entities, lets see how it goes tomorrow.

Research about how ECS is usually used in Lua

Done Today:

  • Added input component.

  • Added delay for multiple clicks in the same input.

  • Added initialization of the mines across the map.

  • Research solution for communication between systems, and triggering of actions like checking some condition to validate the end of the game when a block mine is clicked.

    • After looking at other ecs frameworks I found an event system which allows the systems to listen for events and also to fire new events. Implementing one system like this should resolve the problem.

After the yesterday thoughts, today I added events to my ECS architecture:

  • Added event listeners registration and events triggering of logic to the world and to the systems.
  • Implemented system to check when the game ends, by listening to the action of a mine being pressed.

Today I worked in the web platforms.
Read documentation given by clients and prepared requirements, tasks and all of that to the next work days.

In the Lapis application, made my forms use the table information to make automatic validation in the backend when the form post is received.

Today I made just little changes, I added logging to errors detected by the validation in my forms, which uses the lapis validation.
Since lapis already gives me all the feedback about the invalid fields, it was really simple to make :) . Lapis is very nice.

Added validator to the forms to allow the comparison of 2 fields when in validation.
Implemented user creation with encripted password.
Started the creation of organizations.

  • Added logic for roles and newsletter registering in the User model.
  • Added creation of common users.
  • Added extra validations with default values in the user.
  • Added user creation when starting the creation of a organization.