Are you tired of dependency hell? Are you tired of having to import a library just to use a one-liner function? Do you wish you could just share a piece of useful code simply and easily, without worrying about versions, documentation, etc.? If so, you've come to the right place!
The purpose of this repository is to encourage the sharing and reuse of simple pieces of code, without having to rely on complex infrastructure for managing dependencies. The idea is really simple: for small(ish) pieces of code, that are not expected to evolve in the future, it sometimes makes more sense to just copy the code into your project, rather than include it as a dependency.
The "just use the source" ethic encourages, but does not mandate, the release of code to the public domain. You might want to choose some other license that better fits your needs and requirements. I am not a lawyer.
- Put your amazingly useful code in a single file.
- Include license information, and a repository URL in your code.
- Add license information and adequate documentation.
- Include a "Just use the source" comment in your code.
- Publish your code on GitHub, GitLab or wherever.
Here's a sample source code file that follows the "just use the source" ethic:
# This code is released to the public domain (2023).
# Author: Sharon Rosner
# https://github.com/digital-fabric/just-use-the-source
#
# Just use the source: copy this file into your project, and use it as you wish.
# Implements a greeter class
class Greeter
# Initializes a greeter with the given name.
#
# @param name [String] name to be greeted
def initialize(name)
@name = name
end
# Prints a greeting to STDOUT
#
# @return [Greeter] self
def greet
puts "Hello, #{@name}!"
self
end
end
- Read the code and look for a "Just use the source" mention.
- Make sure the license information meets your use case.
- Copy the code into your project.
- That's all there is to it.