fn convert_to_string(value: u32) []const u8 {
var buffer: [4096]u8 = undefined;
const result = std.fmt.bufPrintZ(buffer[0..], "{d}", .{value}) catch unreachable;
return @as([]const u8, result);
}
Aprendiendo a tirar líneas de código
@SeymourPoler
viernes, 18 de octubre de 2024
how to convert an integer to string in Zig
sábado, 22 de junio de 2024
How to know laptop model in linux
With this little script, we can discover the model of our laptop
for d in system-manufacturer system-product-name system-version bios-release-date bios-version; do echo "${d^} : " $(sudo dmidecode -s $d); done
martes, 11 de julio de 2023
domingo, 30 de abril de 2023
How to Become Fluent on Your Own at Home
Some time ago I watched this video I wrote down some ideas.
Fluency equation
My motivation and my whys.
My real motivation, why I want to learn English.
Setting up a real goal. Setting up a deadline for reaching this goal. In other words, which level I want to have and in which amount of time.
It is basic to get my goals, create a routine, what I have to do on my daily basis.
Other interesting question is, which kind of English do I want to know?, because there are several types of English. English for Business is not the same as English for tourists.
I learned that C1 English level, is when I feel comfortable speaking the language, I can understand almost everything, but not at a native speaker level.
Other important question is how much time do I invest in learning English?
I have to become an independent learner. I have to take the responsibility or the control of your learnings. I am not used to doing that, because in a typical situation, there is a huge number of academies out there which teach English “without effort”. It seems that the responsibility of teaching/learning is the academy, not mine. The truth is that the responsibility for learning English or whatever, is only mine.
One of the strategies about learning English is to create my own bubble of English with lots of inputs. The author of the video calls It immersion. The cons of this method is that it takes a huge number of hours and the learner has to consume a lot of English content to reach their goal.
Other strategy is learning English through sentences, because context matters. It is like learning vocabulary, grammar and pronunciation all together at once. If I repeat them, I will learn how to put different parts of my mouth (tongue, lips and teeth) in the right way. Very interesting approach of that is, by imitation. Recording a sentence and comparing the difference. I think that it is a very good way of improving and learning as well.
An important aspect which we have to consider is to make this process of learning English really fun, because it is a journey which lasts too much time. In this particular case, consistency is very important.
Most of the learning is subconscious, it is the way that the brain works. For me this tip blows my mind up, because most of my learnings have been doing through effort and in a conscious way.
The other side of the very successful English learning method is time. If I have the best method, but I don't have time, I won't learn anything. By the way it is important to include a part of my routine at least 10 minutes every single day, on my daily basis.
lunes, 26 de septiembre de 2022
Remove commit from GIT
remove last pushed commit from local: git reset --hard HEAD~1
update remote branch removing last pushed commit: git push origin HEAD --force
source: hackernoon
viernes, 9 de septiembre de 2022
TDD 2020
As the tests get more specific, the code gets more generic - Robert C. Martin
Prácticas = Principios(Contexto)
Más cercanos a negocio y no tan ligado a la implementación, en vez 'return string empty when is null', mejor 'allow null'
El nombrado de las pruebas
Refactorizar las pruebas
Intentar evitar las variables global o variables estáticas o singleton, que comparten estado
Que los test sean lo más sencillos posibles, sin bucles o condicionales. En una primera versión el tests puede ser complejo, pero una vez está en verde, podemos mejorarlo
Los tests parametrizado, quitan legibilidad porque estamos usando valores que a priori no tiene semántica y también quitamos los nombres de los tests.
los test no pueden garantizar la ausencia total de fallos en el software ni mucho menos
Fast (rápido) -> como mucho unos cuantos segundos
Independent (independiente) -> no tener dependencias con otras pruebas
Repeatable (repetible) inocuo, no altera el sistema
Self-validated (auto-validado) -> contiene aserciones
Timely (oportuno) -> el mejor momento para escribir un test, que resulta ser antes de escribir el código de producción
Xavi Gost: https://www.youtube.com/watch?v=S4Ueg64xfXQ
Dummy: no hace nada, simplemente para cumplir el contrato
Stub: solo datos
Mock: comportamiento (si ha sido llamado)
principios de XP
- Simplicidad: Lo que se busca, al dejar la puerta abierta a la implementación emergente y gradual (las cuatro reglas del diseño simple de Kent beck)
- Comunicación: conversaciones cara a cara, comunicación directa -> metáfora del teléfono escacharrado
- Feedback: just in time programming. La depuración se hace tediosa; arranca la aplicción que pare en los puntos de interrupción, cuando se puede hacer un test unitario.
- Respeto: desapegarse del código. No tomarlo como algo personal. Predicar con el ejemplo. El respeto del equipo se consigue dejando mejor código de lo que se encuentre.
- Valor: ser transparente y sincero.
builders para simplificar los datos de los tests
Property Based Testing
Mutating Testing
Transformation Priority Premise: PrimeFactors and WordWarp katas
https://martinfowler.com/bliki/PageObject.html