Giter Site home page Giter Site logo

mdn.io's Introduction

mdn.io

The "I'm feeling lucky" URL shortener.

Why?

The Mozilla Developer Network is an awesome JavaScript resource. When looking for JavaScript references on something like Function.apply, you might use a search engine with "apply site:developer.mozilla.org" and click the first result.

mdn.io does that for you, and can be configured to search any domain.

Use it in comments when explaining concepts

// Make sure add() takes a single argument (see http://mdn.io/Function.length)
expect(queue.add.length).to.equal(1);

As a lmgtfy replacement for JavaScript questions

friend: dude, is it call() or apply() that takes an array?

you: mdn.io/apply

Type directly in the address bar as a shortcut to search the MDN

mdn.io/bind

mdn.io/closure

mdn.io/cross origin sharing

How does it work?

mdn.io uses DuckDuckGo's Bang! functionality to redirect you to the first search result.

Note that, because this is a search, the page you're redirected to may change in the future. However, you can rest assured that you'll always be redirected to the page that DuckDuckGo finds most relevant.

Searching other domains

mdn.io can be used to search any domain. See the configuration section and fire up your own instance.

Development

npm install # Install dependencies.
npm start # Start server locally.

Configuration

Configure mdn.io with the following environment variables:

Variable Description Default
PORT The port to run the server on. 3000
SERVICE_URL The search service URL to use. https://duckduckgo.com/?q=%21%20%s
SEARCH_DOMAIN The domain to search. developer.mozilla.org
FALLBACK_URL The fallback URL for empty queries. https://developer.mozilla.org/en-US/docs/JavaScript

Alternative service URLs:

  • Google - https://www.google.com/search?btnI&q=%s
  • Bing - http://www.bing.com/search?q=%s (Bing does not have an "I'm Feeling Lucky" equivalent, you'll be redirected to the search result page instead)

Example: Reddit URL shortener

SEARCH_DOMAIN="reddit.com" FALLBACK_URL="http://reddit.com" PORT=8080 npm start

Deployment

npm run deploy

mdn.io's People

Contributors

blakeembrey avatar elchi3 avatar gowee avatar lazd avatar mroderick avatar neverbehave avatar whoaa512 avatar zegnat 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.