Skip to content
/ quotes Public

πŸ’¬ a curated list of quotes that inspire action + code that returns quotes by tag/author/etc. πŸ’‘

License

Notifications You must be signed in to change notification settings

dwyl/quotes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

quotes πŸ’¬

When-you-want-something-all-the-universe

1. A collection of inspiring quotations.

The quotes are contained in a single file: quotes.json so they can easily be used in any project.

2. A module that returns a quote when invoked.

Hex pm npm package version pub package Elixir Build Status Dart Build Status codecov.io contributions welcome HitCount

Why?

We needed a reliable and fast source of quotes. There are many ways of getting quotes including several APIs but we wanted something that had zero latency and could (optionally) work offline so we collated a database from various sources.

gandhi-future-depends-on-what-you-do-today

What?

  1. A file containing thousands of inspiring quotes.
  2. A module for returning a random quote.

The quotes.json file can be used in any project or programming language.

The module can be used from Elixir and JavaScript (Node.js, TypeScript, etc.)
(if you want to use it in a different language please tell us)

How?

There are two ways you can use this project:
A. Use the quotes.json list of quotes directly (for any purpose).
B. Use the module to return a random quote; sample code below.


Elixir

Our original reason for creating the quotes project was to show a practical code reuse example in Elixir.
If you are learning Elixir (and we think you should be), follow along with the code reuse tutorial to see this module in action!

Install from Hex.pm

The quotes Elixir module is available on hex.pm: hex.pm/packages/quotes
Add quotes to your list of deps (dependencies) in mix.exs:

def deps do
  [
    {:quotes, "~> 1.0.7"}
  ]
end

In your terminal run the command:

mix deps.get

That will download the module into your project's deps directory.

Usage in Elixir

To get a random quote from the list invoke:

iex> Quotes.random()

You will receive a Map with an "author" and "text" fields. e.g:

%{
  "author" => "Peter Drucker",
  "text" => "The best way to predict your future is to create it."
}

Some of the quotes have been augmented with a "source" and "tags":

%{
  "author" => "Peter Drucker",
  "source" => "https://www.goodreads.com/quotes/784267",
  "tags" => "time, management",
  "text" => "Until we can manage time, we can manage nothing else."
}

random_by_tag - get a random quote by a specific tag e.g: Quotes.random_by_tag("time")

iex> Quotes.random_by_tag("time")
%{
  "author" => "Leo Tolstoy",
  "text" => "The two most powerful warriors are patience and time."
}

iex> Quotes.random_by_tag("curious")
%{
  "author" => "Albert Einstein",
  "source" => "https://www.goodreads.com/quotes/11458",
  "tags" => "talent, curious, curiosity, passion",
  "text" => "I have no special talent. I am only passionately curious."
}

Dart

Install from Dart packages

dart pub get quotesy

Dart sample code

  • Get the whole list of quotes.
import 'package:quotesy/quotesy.dart';

final quotesArray = await Quotes.list();
[
  {
  "author": "Peter Drucker",
  "text": "The best way to predict your future is to create it."
  }
]
  • Get the list of quotes from a specific author.
import 'package:quotesy/quotesy.dart';

final authorQuotesArray = await Quotes.byAuthor("Peter Drucker");
[
  {
  "author": "Peter Drucker",
  "text": "The best way to predict your future is to create it."
  }
]
  • Get a random quote.
import 'package:quotesy/quotesy.dart';

final randomQuote = await Quotes.random();
{
  "author": "Zig Ziglar",
  "text": "Positive thinking will let you do everything better than negative thinking will."
}
  • Get a random quote from an author.
import 'package:quotesy/quotesy.dart';

final randomQuote = await Quotes.singleRandomByAuthor("William Shakespeare");
{
  "author": "William Shakespeare",
  "text": "Speak low, if you speak love."
}

JavaScript / Node.js

Install from NPM

npm install quotesy --save

Node.js Sample Code:

// Get Random Quote:
const quotes = require("quotesy");
quotes.random(); // expect an object of the following form:
{
  "author": "Peter Drucker",
  "text": "The best way to predict your future is to create it."
}

// get a random quote featuring a desired tag e.g: "time"
quotes.random_by_tag("time");
{
  "author": "Leo Tolstoy",
  "text": "The two most powerful warriors are patience and time."
}

You can always filter the json based on your own custom function:

// Array of quotes with 12 words
const json = require("quotesy").parse_json();
const buddha_quotes = json.filter(function (item) {
  return item.text.split(" ").length <= 12;
});

// Array of quotes for author Buddha
const json = require("quotesy").parse_json;
const buddha_quotes = json.filter(function (item) {
  return item.author === "Buddha";
});

React.js Sample Code:

// Get Random Quote:
import quotes from 'quotesy'

class RandomQuote extends Component {
   state = {
      quote: quotes.random()
   }

   render(){
   const { author, text } = this.state.quote
     return(
       <blockquote>
       	{text}
       <cite>-{author}/cite>
       </blockquote>

     )
   }
}


Need a Different Programming Language ...?

Want to add an example in your preferred programming language?
Please comment on this issue: quotes/issues/6



Contributing

As with all @dwyl projects, contributions are very much welcome!
There are 3 ways of contributing to the quotes project:

  1. Curate
  2. Add
  3. Share

1. Curate the Existing Quotes

Read through the existing quotes and check they are accurate, insightful and inspires positive action. Accuracy means no misquotes or misattributions (attributing a quote to an author when in fact they never said/wrote it). Insightful means it gives us some insight that we can apply to our own lives. Inspires positive action is vital, we aren't interested in quotes with a negative tone.

For example, consider the following quote which is not included in our list:

"Happiness in intelligent people is the rarest thing I know.” ~ Ernest Hemingway

This quote is certainly interesting and it may even be true in certain cases; some of the most intelligent people in history have been utterly miserable for whatever reason. While the quote is insightful it's definitely not positive and does not inspire any action.

Improve Existing Quotes with Sources & Tags

Open the quotes.json file and scroll through the quotes.
If you find a quote that you like (that doesn't already have "source" or "tags") you can _enhance it with a source and tags.

For example, consider the following quote (before the addition of a source or tags):

{
  "author": "Albert Einstein",
  "text": "I have no special talent. I am only passionately curious."
},

To find a reputable source, simply copy paste the quote into your favourite search engine:

https://duckduckgo.com/?q=I+have+no+special+talent.+I+am+only+passionately+curious

duck-duck-go-search-for-einstein-quote

Click the link to visit the source and confirm that it's good.

https://www.goodreads.com/quotes/11458-i-have-no-special-talents-i-am-only-passionately-curious

goodreads-einstein-quote

We only need the part of the URL up to the end of the digits: https://www.goodreads.com/quotes/11458
(the rest is added to the URL for SEO purposes and is not required to find the resource)

Add the source and any relevant tags:

{
  "author": "Albert Einstein",
  "text": "I have no special talent. I am only passionately curious.",
  "source": "https://www.goodreads.com/quotes/11458",
  "tags": "talent, curious, curiosity, passion"
},

Open the quotes.json file in your web browser (while logged-in to GitHub):

github-click-pencil-icon-to-edit

Click the pencil icon to edit the file. Once in edit mode, locate the quote by searching for it:

locate-the-quote

Make the edit to add the "source" and "tags": update-the-quote

Scroll down to the bottom of the page till you see Commit changes
(or use your browser shortcut to go to the bottom e.g: the [End] key)

add-commit-message-and-branch-name

Write a descriptive commit message and give your branch and appropriate/obvious name:
e.g: add-source-and-tags-to-einstein-quote

Click the button that says "Propose file change".

Your browser will navigate to the "Open a pull request" page:

create-pull-request

Add a relevant description and click the "Create pull request" button.

Example: #7

pull-request-awaiting-review

Provided your changes/improvements pass the automated checks and are sensible,
they will be approved and merged by an existing member of the project:

pull-request-merged

Once you've contributed an improvement, you'll be invited to be a maintainer and will be able to approve other people's additions.

2. Add Quotes!

If there is a quote you find inspiring/motivating that is not already in the quotes.json file, please add it!

Guidelines for Good Quotes

Keep the length of quotes below 200 characters.

Avoid adding quotes that are essays; the shorter the quote the better.
For example:

"Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They're not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can't do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do." ~ Rob Siltanen

That quote is 101 words (547 characters); it's an essay. It was the script written by Siltanen for the Apple "Think Different" commercial. We prefer the short version (18 words | 85 characters):

"The people who are crazy enough to think they can change the world are the ones who do." ~ Rob Siltanen

There is definitely a place for longer quotes e.g: the "Think Different" Apple ad campaign.

apple-think-different-advert

Our purpose with this bank of quotes is to have brief quotes that take less than 10 seconds to read and are inspiring/motivating not distracting.

In this case the addition would be:

{
  "text": "The people who are crazy enough to think they can change the world are the ones who do.",
  "author": "Rob Siltanen",
  "source": "https://www.goodreads.com/quotes/597615",
  "tags": "change, world, apple, think, different"
}

Note: This is also a good example of a quote that has been misattributed. Given that Steve Jobs read the script in the Apple "Think Different" commercial, people often misattribute the quote to Steve. A minute of research and we are better informed: https://www.forbes.com/sites/onmarketing/2011/12/14/the-real-story-behind-apples-think-different-campaign
Jobs initially called the script β€œsh*t” ... Read the article, it's a fascinating insight into the creative process!

Avoid Quotes That Don't Inspire Action

Karl-Pilkington-quote-glass-houses

Karl Pilkington is often hilarious and even insightful, but this quote while amusing, does not inspire any action in the reader.

Film Quotes

Movies can often be thought provoking, insightful and positive. e.g:

do-or-do-not-yoda

Where a quote from a movie is relevant, add it like this:

{
  "text": "Do. Or do not. There is no try",
  "author": "Yoda",
  "source": "https://www.starwars.com/news/the-starwars-com-10-best-yoda-quotes",
  "tags": "fictional, movie, do, try, star wars"
},

3. Share!

  • Let others know about this bank of quotes by "starring" the project on GitHub! ⭐️
  • If you have an interesting use case for quotes, please share!

Disclaimer for contributions

If you are thinking of contributing to this repository (hooray! πŸŽ‰), please make sure you read the Contributing section of this repo.

There are many websites that already contain quotes and this repository is intended as a subset of uniquely inspiring quotes. See Avoid Quotes That Don't Inspire Action.

As such, we remind you that we will only be able to accept PRs that conform to the following key criteria:

  1. An issue has been opened to propose the quote, including why you find it particularly inspiring πŸ’‘
  2. That issue has received at least 2 'thumbs up' (:+1:) from people in the dwyl community.
  3. Your PR refers to the issue itself and has a clear title and description. Not "Updates Quotes".

Thank you again for your contributions to this and other dwyl repos, we very much appreciate it! ❀️


Pull Request "Rejection"?

As noted above, this repo focusses on quotes that unequivocally inspire action.

If a quote just makes people think, but doesn't inspire action we may not merge your Pull Request ... 😞

Please don't be personally offended. You're very welcome to fork the project and use it as the basis for your own list of quotes. Many people have forked: dwyl/quotes/network/members that is the beauty of Open Source. 🌻