{"id":13835705,"url":"https://github.com/rkh/almost-sinatra","last_synced_at":"2025-04-04T18:09:34.142Z","repository":{"id":1405690,"uuid":"1455833","full_name":"rkh/almost-sinatra","owner":"rkh","description":"Sinatra refactored, only six lines now. More popular than a pair of socks.","archived":false,"fork":false,"pushed_at":"2023-10-11T03:42:10.000Z","size":27,"stargazers_count":517,"open_issues_count":1,"forks_count":55,"subscribers_count":17,"default_branch":"trunk","last_synced_at":"2024-10-14T19:42:48.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"haraldmartin/things-rb","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rkh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-03-08T18:54:33.000Z","updated_at":"2024-10-13T20:27:55.000Z","dependencies_parsed_at":"2024-10-25T18:43:40.805Z","dependency_job_id":"485e3547-a043-4526-8cd6-4f24da4fff70","html_url":"https://github.com/rkh/almost-sinatra","commit_stats":{"total_commits":56,"total_committers":14,"mean_commits":4.0,"dds":0.6071428571428572,"last_synced_commit":"bfd77fae3b191ed4f324940dfa88d5d40c54e1c8"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkh%2Falmost-sinatra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkh%2Falmost-sinatra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkh%2Falmost-sinatra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkh%2Falmost-sinatra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkh","download_url":"https://codeload.github.com/rkh/almost-sinatra/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226215,"owners_count":20904465,"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-08-04T14:01:10.169Z","updated_at":"2025-04-04T18:09:34.121Z","avatar_url":"https://github.com/rkh.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Almost Sinatra\n\n[![Code Climate](https://codeclimate.com/github/rkh/almost-sinatra.png)](https://codeclimate.com/github/rkh/almost-sinatra)\n[![Build Status](https://travis-ci.org/rkh/almost-sinatra.png?branch=master)](https://travis-ci.org/rkh/almost-sinatra)\n\n    \"until programmers stop acting like obfuscation is morally hazardous,\n    they’re not artists, just kids who don’t want their food to touch.\" - _why\n\nA Sinatra implementation in less than 10 lines.\nDependencies: Tilt and Rack (like Sinatra).\nOnly works on Ruby 1.9.\n\nFeatures:\n\n* all template engines Sinatra supports\n* get/post/put/delete\n* before filters\n* configure/set/enable/disable/...\n* session/params\n* support for helpers\n* stand alone usage\n* inline templates\n* thread safe\n* works with Padrino\n\nIt is considered fully compatible with Sinatra. If your app does not run with\nAlmost Sinatra, please open a [Sinatra issue](https://github.com/sinatra/sinatra/issues).\n\n## Installation\n\nCopy the contents of `almost_sinatra.rb` into your app file (at the top), that\nway you also avoid running the wrong version by accident.\n\n## Try it\n\n    $ ruby example.rb\n    What Sinatra implementation should I use?\n    [R]eal Sinatra\n    [A]lmost Sinatra\n    \u003e\u003e a\n\n## Modular style\n\nWhen pasting the Almost Sinatra code into your file, replace `Application=$a`\nwith `Base=$a` (second line atm, but don't expect me to update the readme if\nI move stuff around).\n\n## Performance\n\nIt's just amazing. No code is faster than no code.\n\n    $ sloccount alomst_sinatra.rb\n    Total Physical Source Lines of Code (SLOC)                = 8\n    Development Effort Estimate, Person-Years (Person-Months) = 0.00 (0.02)\n     (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))\n    Schedule Estimate, Years (Months)                         = 0.04 (0.51)\n     (Basic COCOMO model, Months = 2.5 * (person-months**0.38))\n    Estimated Average Number of Developers (Effort/Schedule)  = 0.03\n    Total Estimated Cost to Develop                           = $ 170\n     (average salary = $56,286/year, overhead = 2.40).\n\n    $ sloccount ../sinatra\n    Total Physical Source Lines of Code (SLOC)                = 5,771\n    Development Effort Estimate, Person-Years (Person-Months) = 1.26 (15.12)\n     (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))\n    Schedule Estimate, Years (Months)                         = 0.58 (7.02)\n     (Basic COCOMO model, Months = 2.5 * (person-months**0.38))\n    Estimated Average Number of Developers (Effort/Schedule)  = 2.15\n    Total Estimated Cost to Develop                           = $ 170,198\n     (average salary = $56,286/year, overhead = 2.40).\n\nAs you can see Sinatra is 1000000% more expensive than Almost Sinatra!\n\nGenerated using David A. Wheeler's 'SLOCCount'.\n\n## Coding guidelines\n\n* keep code under ten lines, this includes require and whatnot\n\n* avoid spaces and newlines if possible\n\n* wrap at 200 characters to make it readable on a terminal\n\n* newlines may be used instead of `;` to improve readability\n\n* use `map` instead of `each`, it's shorter\n\n* store constants in global variables to dry up your code (like `$f = File`)\n\n* if you have one loop, reuse it. instead of this:\n\n        ['a','b'].map{|e|...}\n        [Rack::Something].map{|e|...}\n\n  do this:\n\n        ['a','b',Rack::Something].map{|e|(e==e.to_s)?(...):(...)}\n\n  Saves a line!\n\n* `e==\"#{e}\"` is shorter than `e.is_a? String` or `String===e`\n\n* use `-\u003e{}` instead of `proc` or `lambda` (this is why it depends on 1.9)\n\n* add methods for class scope to `$o` and for instance scope to `$a` (or `$o`),\n  see [Scopes And Binding](http://www.sinatrarb.com/intro#Scopes%20and%20Binding)\n\n* don't include tests. tests just bloat the code base. just commit, the users\n  will complain if you break anything.\n\n## About Versioning\n\nVersions are to Software what Subversion is to Git.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkh%2Falmost-sinatra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkh%2Falmost-sinatra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkh%2Falmost-sinatra/lists"}