All Projects → BrandonShar → Stack Overflow Buddy

BrandonShar / Stack Overflow Buddy

Licence: unlicense
A friendly, error prone coding companion

Projects that are alternatives of or similar to Stack Overflow Buddy

Binexp
Linux Binary Exploitation
Stars: ✭ 742 (+375.64%)
Mutual labels:  stackoverflow
Talkyard
A community discussion platform: Brings together the main features from StackOverflow, Slack, Discourse, Reddit, and Disqus blog comments.
Stars: ✭ 1,219 (+681.41%)
Mutual labels:  stackoverflow
Decryptlogin
APIs for loginning some websites by using requests.
Stars: ✭ 1,861 (+1092.95%)
Mutual labels:  stackoverflow
Sosl
StackOverflow Search Library
Stars: ✭ 10 (-93.59%)
Mutual labels:  stackoverflow
Netnr.login
项目已迁移至
Stars: ✭ 75 (-51.92%)
Mutual labels:  stackoverflow
So Eclipse Plugin
Eclipse plugin that enables you to get answers from Stack Overflow directly to your IDE 🔥
Stars: ✭ 84 (-46.15%)
Mutual labels:  stackoverflow
Stackoverflow Dark
📚 Dark theme for Stack Overflow & most Stack Exchange network sites
Stars: ✭ 671 (+330.13%)
Mutual labels:  stackoverflow
Solang
First fully featured programming language for Stack Overflow Driven Development
Stars: ✭ 133 (-14.74%)
Mutual labels:  stackoverflow
Gso
🏃 Google StackOverflow in Vim. Copy-pastes the code directly in your script.
Stars: ✭ 75 (-51.92%)
Mutual labels:  stackoverflow
Routinepanic.com
🌐 协慌网 - 专注编程问答汉化。
Stars: ✭ 103 (-33.97%)
Mutual labels:  stackoverflow
Socli
Stack overflow command line client. Search and browse stack overflow without leaving the terminal 💻
Stars: ✭ 911 (+483.97%)
Mutual labels:  stackoverflow
Psstackexchange
PowerShell module to query Stack Exchange API
Stars: ✭ 67 (-57.05%)
Mutual labels:  stackoverflow
Hn so analysis
Is there a relationship between popularity of a given technology on Stack Overflow (SO) and Hacker News (HN)? And a few words about causality
Stars: ✭ 94 (-39.74%)
Mutual labels:  stackoverflow
Custombottomsheetbehavior
Custom BottomSheetBehavior for Android that mimic Google Maps behavior
Stars: ✭ 844 (+441.03%)
Mutual labels:  stackoverflow
Tagoverflow
An interactive map of Stack Exchange tags for all sites.
Stars: ✭ 117 (-25%)
Mutual labels:  stackoverflow
So
A terminal interface for Stack Overflow
Stars: ✭ 694 (+344.87%)
Mutual labels:  stackoverflow
So Mod Userscripts
Stack Overflow Moderation Userscripts
Stars: ✭ 81 (-48.08%)
Mutual labels:  stackoverflow
Upvotejs
UpvoteJS generates a voting widget like the one used on Stack Exchange sites
Stars: ✭ 137 (-12.18%)
Mutual labels:  stackoverflow
Stackoverflow python
stackoverflow上关于python的翻译
Stars: ✭ 119 (-23.72%)
Mutual labels:  stackoverflow
Learning Social Media Analytics With R
This repository contains code and bonus content which will be added from time to time for the book "Learning Social Media Analytics with R" by Packt
Stars: ✭ 102 (-34.62%)
Mutual labels:  stackoverflow

Stack Overflow Buddy

Inspired by the revolutionary work done by @drathier and their stack-overflow-import, Stack Overflow Buddy is your own personal PHP based Stack Overflow assistant!

Why spend your valuable time cutting and pasting from StackOverflow when Stack Overflow Buddy can do it for you? Who wouldn't trade all safety checks and only the basest of functionality checks for a bit of convenience?

Installation

composer require brandonshar/stack-overflow-buddy

Because Stack Overflow Buddy uses untagged libraries, you may need to add the following lines to your composer root

"minimum-stability": "dev",
"prefer-stable": true
# and in your files you use it
use brandonshar\StackOverflowBuddy;

What's it do?

Just give it a try!

StackOverflowBuddy::mergeSort([2,3,1,4]);
// [1, 2, 3, 4]

Impressed?

How about

StackOverflowBuddy::substringBetweenTwoStrings('platypus', 'pl', 'us');
// atyp

Wow, how's it work?

If you're impressed, you should probably stop reading here.

  1. Split the camelCased function call into words
  2. Grab the top scoring PHP tagged questions with those words in the title from StackOverflow's API
  3. Grab the top scoring answers for those questions
  4. Pull any and all code blocks from those answers
  5. Find the first code block that:
    1. Inteprets without error
    2. Contains one or more functions
    3. One of the functions has the same amount of arguments as were passed by the user
  6. Then we throw caution to the wind, eval, and call the new method!

Wow, this will change my workflow forever!

It certainly will. But don't forget to use some of that time you're saving to thank the original author of the code you've now absorbed.

var_dump(StackOverflowBuddy::giveThanksFor('substringBetweenTwoStrings'));
/*
["author"]=>
  string(18) "Alejandro Iglesias"
  ["authorLink"]=>
  string(57) "https://stackoverflow.com/users/425741/alejandro-iglesias"
  ["questionLink"]=>
  string(35) "https://stackoverflow.com/a/9826656"
*/

What if StackOverflowBuddy can't find any good code for my method?

In the incredibly unlikely (ok... maybe not incredibly unlikely) event that StackOverflowBuddy can't find any code that meets your request, it'll throw you a HaveToWriteYourOwnCodeException to keep you busy while hopefully someone else gives a better answer on Stack Overflow.


Testimonials

If you're still on the fence, don't take my word for it; here's what a satisifed reader of the code had to say:

"I love how this makes on the fly software updates really easy. If I ever need to tweak an algorithm or fix a bug, I just need to submit a really good answer to stack overflow with the updated code. Goodbye source control!"

- Pseudofailure


Warning-ware

You're free to use this package, but if it makes it to your production environment you accept the responsibility of personally telling each of your users that they would be better off hiding their data under their mattress.


Notes

Keep in mind that every usage of this makes two requests to the StackOverflow API and they will rate-limit you after a certain number of requests per day. But that shouldn't really be an issue since no one sensible would ever use this for anything.


Contributing

Have a blast. There is currently only one end to end integration test that requires the index.php file to be reachable from a local server. I just used Laravel Valet. This code does not follow PSR-2 and deliberately uses no typehints or visiblity as I decided to do a similar style experiment to the required Zttp library. Even if you're the strictest PHP writer there is, not following a style guide is at best, like the 5th reason you should never use this code.


License

The Unlicense. If there's a less restrictive license with even less liability, let's go with that. Anyone who thinks that using this license is to the detriment of my heirs clearly didn't look at it very carefully.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].