Giter VIP home page Giter VIP logo

onelinerhub's Introduction

Onelinerhub

Lib of micro code pieces, well explained and mostly single-line solutions @ onelinerhub.com.

Why we do it and where we go

We're building non-profit opensource code hub to address following issues:

  • clear simple modern solutions for repeatable coding challeges
  • moderated single-standard solutions instead of "here's a list of 25 answers with 125 comments"
  • code parts explanations to fight dumb copy-paste, but educate instead
  • no ads, no paid access, just community contributions and usefulness instead of profits

Help by contributing

Feel free to add/update any tech code piece you find useful.

Principles

  • 3 main principles for code pieces here are: simple, modern, minimal
  • Micro solutions are ment to solve specific issue in modern versions of technologies (browsers, compilers, databases, etc.)
  • Solution should be as short and simple as possible
  • Solution should be explained by components (variables, functions, operations, etc.)
  • Image illustrations are welcome

Code file micro-format

  • Each code file should be placed in it's main technology folder (e.g. "php", "bash", etc).
  • File should have short but understandable naming in underscore format (e.g. "redirect_header.md")
  • Extension is always ".md", so all the markdown works
  • File must include title ("# title") as the first line (technology title is automatically added in UI {title} #{technology})
  • File must include actual code snippet in the highlighted code block
  • File should also include code parts description, so it's well explained (example in template)
  • File can also include group definition to link similar solution (e.g. different date formats or string comparison methods)
  • You can upload PNG file with the same file name as the code file and it will automatically be rendered in UI
  • Example can be specified using ## Example header followed by 2 code blocks (input and output examples)

Use this template for creating new code pieces.

FAQ

"What if I want to create new folder/technology in onelinerhub repo?"

You are welcome to do it with pull request as long as it is useful technology/solution for engineers

"What if I want to edit some published code?"

You are welcome to do it with pull request as long as it will make the code better (simple, modern, minimal)

"Can I post multi-line code (not a one-liner)?"

Yes, as long as the solution is targeted towards specific problem and is well explained

API

We're happy to provide our code collection for integrations of all types. At this point, search API is available publicly with no need to register any keys.

Usage is as simple as calling api.onelinerhub.com/search endpoint with quqery parameter (GET or POST):

curl "https://api.onelinerhub.com/search?query=php+header+json"

You'll get JSON array with the following objects:

{
  "url": "...", // public URL of the code piece page
  "tech": "...", // technology of this code
  "subject": "...", // Full title for the code
  "lang": "...", // Code piece language
  "code": "..." // Code piece itself
}

Example:

[
    {
        "url": "https:\/\/onelinerhub.com\/javascript\/fetch_post_uri",
        "tech": "javascript",
        "subject": "Ajax post x-www-form-urlencoded data",
        "lang": "javascript",
        "code": "fetch('\/backend.php', {\n  method: 'post',\n  headers: { 'Content-Type': 'application\/x-www-form-urlencoded;charset=UTF-8' },\n  body: 'var1=' + encodeURIComponent('Donald Trump :(') + '&var2=123'\n}).then(function(r) {\n  return r.json();\n}).then(function(data) {\n  console.log(data);\n});"
    },
    {
        "url": "https:\/\/onelinerhub.com\/php\/json_content_type",
        "tech": "php",
        "subject": "Set content type to JSON",
        "lang": "php",
        "code": "header('Content-Type: application\/json');\necho json_encode([]);"
    }
]

Integrations

onelinerhub's People

Contributors

nonunicorn avatar mrcrypster avatar joshuahenriques avatar f4r4n avatar mdfarhaan avatar h-ssiqueira avatar ozanbaskan avatar chrdek avatar kulbhushanchand avatar blazeryoo avatar pushpendersaini0 avatar gabrieltheophilo avatar shellroti avatar ahmad-ali14 avatar donno2048 avatar pratham-bhatnagar avatar askorupskyy avatar trojan0x avatar adierebel avatar rinatvaliullov avatar pedrosusername avatar nedimcanulusoy avatar helvieq499 avatar anvi98 avatar jishanshaikh4 avatar meerhamzadev avatar mdsscml avatar marcenavuc avatar truonghoangthuan avatar trongbui1105 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.