{"id":13466427,"url":"https://github.com/ythecombinator/safadometro","last_synced_at":"2025-04-09T11:11:16.754Z","repository":{"id":82686829,"uuid":"47948272","full_name":"ythecombinator/safadometro","owner":"ythecombinator","description":"👼Polyglot implementations of \"safadeza\" calculus.","archived":false,"fork":false,"pushed_at":"2020-03-06T22:53:32.000Z","size":918,"stargazers_count":217,"open_issues_count":8,"forks_count":55,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-02T03:59:11.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ythecombinator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-12-14T02:46:48.000Z","updated_at":"2025-02-25T16:12:47.000Z","dependencies_parsed_at":"2023-06-12T19:00:39.717Z","dependency_job_id":null,"html_url":"https://github.com/ythecombinator/safadometro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ythecombinator%2Fsafadometro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ythecombinator%2Fsafadometro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ythecombinator%2Fsafadometro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ythecombinator%2Fsafadometro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ythecombinator","download_url":"https://codeload.github.com/ythecombinator/safadometro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027407,"owners_count":21035594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T15:00:43.985Z","updated_at":"2025-04-09T11:11:16.731Z","avatar_url":"https://github.com/ythecombinator.png","language":"Elm","funding_links":[],"categories":["Elm","Standalone projects"],"sub_categories":[],"readme":"# safadômetro\n\n\u003e Polyglot implementations of *\"safadeza\"* calculus.\n\n![Aquele 1%](cover.png)\n\n## Table of Contents\n\n- [The Problem](#the-problem)\n- [Motivation](#motivation)\n- [Contributing](#contributing)\n- [Status](#status)\n- [Importance](#importance)\n- [License](#license)\n\n## The Problem\n\nSometimes, you want to know how **safad(o/a)** - a Brazilian Portuguese word for\n*naughty* - someone is. A very popular Brazilian musician desbribes himself as\nbeing `99%` an angelical and perfect person; but the other `1%` is naughty - as\nyou can see [in the lyrics](http://www.vagalume.com.br/marcos-e-belutti/aquele-um-por-cento-part-wesley-safadao.html).\n\nA very clever professor from a state university in Brazil proposed a way o calculing\nhow *safado* some is based on his/her date of birth.\n\nThe *magical formula* needs:\n\n- A `sum` function which takes an `int` a returns the sum of it with all its\nprevious positive integers, e.g. `sum(5) = 5 + 4 + 3 + 2 + 1`.\n\n- A `safadeza` function which is given by:\n\n  `safadeza = sum(month) + (year / 100) * (50 - day)`\n\n- An `angel` function which is given by:\n\n  `angel = 100 - safadeza`\n\n_The last two functions **MUST** return a float_\n\nSo this repo is for writing code that shows others how *safado* they are.\n\nI look forward to seeing what you come up with c:\n\n## Motivation\n\n![Where everything started.](question.jpg)\n\n\u003e The programming question which quotes Wesley Safadão and turned to be a hit\non the web.\n\nIt all started when a professor from the Quixadá campus of the Federal University\nof Ceará - *Universidade Federal do Ceará (UFC)* - Jefferson de Carvalho called\neveryone's attention by using a hit of the *sertanejo* and *forró music* to teach\nimperative programming logic to his students.\n\nHe was inspired by the song *[Aquele 1%](http://www.vagalume.com.br/marcos-e-belutti/aquele-um-por-cento-part-wesley-safadao.html)*,\nwhich is a success from the duo Marcos \u0026 Belutti featuring a very popular\nBrazilian musician, Wesley Safadão, to write his logical challenge.\n\n\u003e If you'd like to find out more content about this funny story, [there are](http://g1.globo.com/ceara/noticia/2015/12/professor-cita-wesley-safadao-em-questao-de-logica-e-vira-hit-na-web.html)\n[lots](http://revistagalileu.globo.com/blogs/buzz/noticia/2015/12/professor-universitario-usa-wesley-safadao-em-prova-de-programacao.html)\n[of](http://gazetaonline.globo.com/_conteudo/2015/12/entretenimento/cultura_e_famosos/3917154-professor-cita-wesley-safadao-e-questao-de-logica-e-bomba-na-web.html)\n[good resources](http://www.opovo.com.br/app/divirta-se/2015/12/04/noticiasdivirtase,3544424/professor-da-ufc-elabora-questao-de-prova-fazendo-referencia-a-wesley.shtml)\n[on the web](http://www.ibahia.com/detalhe/noticia/professor-cita-wesley-safadao-em-questao-de-prova-e-faz-sucesso/?cHash=74e1cc909aa2269eb81a4401b282d892)\n[about it](http://maisregiao.com.br/professor-cita-wesley-safadao-em-questao-de-prova-e-faz-sucesso/).\n\n## Contributing\n\n### Basic Requirements\n\n- You **MUST** be listening to the [music](http://www.vagalume.com.br/marcos-e-belutti/aquele-um-por-cento-part-wesley-safadao.html) while coding.\n- If you have to stop listening, close the editor - your time is over!\n- Please, don' use tabs. Tabs are from Satan. Use spaces. - actually,\njust follow the basic [styleguide](.editorconfig).\n\n### Adding a New Implementation\n\n1. Just think of your own interpretation of the problem.\n1. Check if anyone has suggested this before [here](https://github.com/mabrasil/safadometro/pulls).\n1. Fork this project!\n1. Create a new folder with the name of the language you've used in your solution, e.g. `javascript/`.\n1. If the language you want to implement already has an implemention, make `version-*` in the folder!\n1. **Put the implementation and the example in separated files**.\n1. Tick the language - with `- [x]` in *GitHub Flavored Markdown* - in which\nyou've implemented [here](STATUS.md).\n1. Commit your changes: `git commit -m 'Add JavaScript version'`.\n1. Push to the branch: `git push origin master`.\n1. Submit a pull request :)\n\n\u003e If you'd like to contribute with a language in which the algorithm has already\nbeen implemented - but you have a *new/special/different/whatever* way of making -,\nyou can make it! Just create a new folder inside the folder of the language, e.g.\n`javascript/browser`, `javascript/node`, `javascript/react` etc.\n\n### Adding a New Language\n\n1. Check if anyone has suggested this before [here](https://github.com/mabrasil/safadometro/pulls).\n1. Fork this project!\n1. Add the language to the [languages tracking file](STATUS.md) - **don't forget to obey alphabetical order**.\n1. Commit your changes: `git commit -m 'Add JavaScript to listed languages'`.\n1. Push to the branch: `git push origin master`.\n1. Submit a pull request :)\n\n## Status\n\nYou can check a list of languages in which the problem's been implemented - or\nshould've been - [here](STATUS.md).\n\n## Importance\n\nThis project may seem useless, but, amazingly, **it is not**.\n\nIn about two days it achieved something interesting: a deterministic algorithm said\nto be *simple* which when implemented in [40+ languages](STATUS.md), tells us a lot!\nE.g.\n\n- It shows us a different *programming logic* from the imperative one we are\nprobably used to think, such as declarative.\n\n- It allows us to think in different paradigms from the ones we are probably used\nto think, e.g. functional and logical ones.\n\n- It allows us to study and analyze *new implementations* in *new langs*, for example:\na taste of [Smalltalk](https://github.com/mabrasil/safadometro/blob/master/smalltalk/WesleySafadao.st)'s pure Object\nOrientation - *hooray for Allan Kay, Adele Goldberg et al!* - or a bit of\nfunctional programming in [Haskell](https://github.com/mabrasil/safadometro/blob/master/haskell/WesleySafadao.hs) - and\nits beautiful *type system, monads etc.* - or the different *logic* that a\nlanguage based on Horn Clauses such as [Prolog](https://github.com/mabrasil/safadometro/blob/master/prolog/WesleySafadao.pl) reveals.\n\n- Or, amazingly, the underground languages that we don't know - after all, getting to\nknow a [DSL written in JS, which has a different approach to prototype-based OO](https://github.com/mabrasil/safadometro/blob/master/siren/Safadão.siren)\nor a [declarative DSL written in TypeScript and LiveScript which has a type system inspired by Idris and aims printers](https://github.com/mabrasil/safadometro/blob/master/capybara/WesleySafadao.capy) is not something you do every day.\n\nSo the lesson is: **that kind of initiative shows us that in modern times not only\nwith *FizzBuzz-alike* implementations you can learn programming logic/languages/\nparadigms**.\n\n## License\n\n[safadômetro](https://github.com/mabrasil/safadometro) is distributed under the\nMIT License, available in this repository. All contributions are assumed to be also licensed under\nthe MIT License.\n\n\u003e Wesley Oliveira da Silva, also known as *Wesley Safadão*, is a Brazilian singer, songwriter, producer, and businessman. The *safadômetro* project does not have any rights over anything related to the him; images, logos, and everything related to the him have All Rights Reserved to *Wesley Safadão \u0026 Banda Garota Safada*.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fythecombinator%2Fsafadometro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fythecombinator%2Fsafadometro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fythecombinator%2Fsafadometro/lists"}