Giter VIP home page Giter VIP logo

onelinerhub's Introduction

Onelinerhub

Lib of well explained and minimalistic code solutions @ onelinerhub.com

Quick links

Why we do it and where we go

  • clear simple modern solutions for repeatable coding problems
  • 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

Principles

  • 3 main principles for code pieces here are: simple, modern, minimal
  • Micro solutions are meant 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

Contributors are welcome

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

onelinerhub's People

Contributors

adierebel avatar ahmad-ali14 avatar aimaribarra avatar askorupskyy avatar blazeryoo avatar burhanharoon avatar chrdek avatar donno2048 avatar f4r4n avatar gabrieltheophilo avatar gokhalen avatar h-ssiqueira avatar hetsonii avatar intern0t avatar joshuahenriques avatar krdecadezero avatar kulbhushanchand avatar laughlinbrian avatar lucablackwell avatar mdfarhaan avatar mrcrypster avatar nonunicorn avatar ozanbaskan avatar pratham-bhatnagar avatar pushpendersaini0 avatar rinatvaliullov avatar rithyareddy avatar shellroti avatar surya-29 avatar trojan0x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

onelinerhub's Issues

Code [NGINX] / request time log

http {
log_format api '[$time_local] $remote_addr: '
    '"$request" ($status) $body_bytes_sent bytes '
    '$request_time s $upstream_response_time s';
# ...
server {
# ...
  access_log /var/log/nginx/api.log api;

[supervisor] / export display

[program:test]
command=export DISPLAY=:0 && python test.py
user=root
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/test.log
loglevel=info

Search API

What about some API for search or getting snippet ?
I just wanna make an app, but not fan of parsing LOL

Suggested copy area

In chart.js code pieces it's more convenient to copy just a part of configuration options by default, instead of whole code example. Think of creating new markup way to highlight default copying area in such cases.

Can't scroll past first page

Using Firefox (actually Waterfox Classic), looking at Python one-liners -- can only view first page. No way to scroll further, either with cursor or arrow keys.

Code [PHP] array to csv

function csvstr(array $fields) : string
{
$f = fopen('php://memory', 'r+');
if (fputcsv($f, $fields) === false) {
return false;
}
rewind($f);
$csv_line = stream_get_contents($f);
return rtrim($csv_line);
}

JS / before unload confirmation

window.onbeforeunload = function(e) {
  var dialogText = 'Dialog text here';
  e.returnValue = dialogText;
  return dialogText;
};

Form data fetch post example

const formData = new FormData();
const fileField = document.querySelector('input[type="file"]');

formData.append('username', 'abc123');
formData.append('avatar', fileField.files[0]);

try {
  const response = await fetch('https://example.com/profile/avatar', {
    method: 'PUT',
    body: formData
  });
  const result = await response.json();
  console.log('Успех:', JSON.stringify(result));
} catch (error) {
  console.error('Ошибка:', error);

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.