PROJET AUTOBLOG


bfontaine.net

Site original : bfontaine.net

⇐ retour index

Open Spotify links with the Desktop client

mardi 23 juillet 2013 à 21:55

Spotify’s Web app is great, but you may prefer to use the desktop client. The problem is that the links default to the Web app. Here is a quick tip to make what you want.

First, install Switcheroo. It’s a Chrome extension (Firefox users, go here) that allows you to setup custom redirect rules for any http request, using a string replacement. Then, add a rule to replace http://open.spotify.com/ with spotify://.

That’s it! Now, all open.spotify.com/something links will open in the desktop client instead of the Web one.

Note: I found the original tip here, but it was not working because the author suggested to replace with spotify instead of spotify://.

Open Spotify links with the Desktop client

mardi 23 juillet 2013 à 21:55

Spotify’s Web app is great, but you may prefer to use the desktop client. The problem is that the links default to the Web app. Here is a quick tip to make what you want.

First, install Switcheroo. It’s a Chrome extension (Firefox users, go here) that allows you to setup custom redirect rules for any http request, using a string replacement. Then, add a rule to replace http://open.spotify.com/ with spotify://.

That’s it! Now, all open.spotify.com/something links will open in the desktop client instead of the Web one.

Note: I found the original tip here, but it was not working because the author suggested to replace with spotify instead of spotify://.

Get the Urban Dictionary in your terminal

mardi 4 juin 2013 à 22:16

The Urban Dictionary website is pretty useful when one wants to know the meaning of any familiar or slang word. Users can write definitions for any words, and upvote or downvote them. Unfortunately, the website doesn’t have a public API, and I couldn’t find a command-line tool for it. So I wrote one.

Introducing ud

ud is a command-line tool which prints definitions from the Urban Dictionary website. It’s written in Ruby, and allows you to quickly search for a definition of any word.

$ ud wth
* WTH (567/126):

   1) Abbreviation for "What the Hell"
   2) Shortened alternative to "With"

 Example:
   1) WTH was that?!
   2) I ate some crackers wth chicken
(…)

For common abbreviations like “wtf” or “omg”, there are dozens of definitions, with minor differences. That’s why the script scraps only the first page of results, and supports a few options: -n allows you to limit the number of definitions (e.g. -n 1 → only one). -r allows you to select only the definitions which have an upvotes/downvotes ratio higher than what you want, e.g. -r 2 will select only the definitions which have twice more upvotes than downvotes. For your convenience, it also support the shortcut -u which is an alias for -r 2. Type ud -h for more info.

Install

That’s easy:

gem install ud

Please note that if you’re using Windows, you’ll need to install the Win32 Console ANSI gem for the colored output. Install it with:

gem install win32console

Using the UD module

The gem also provide a UD module, which you can use to query the website in your own Ruby code:

require 'ud'

wtf = UD.query 'wtf', :count => 1

puts wtf[0].keys.join ', '
#=> id, word, definition, example, upvotes, downvotes

Get the Urban Dictionary in your terminal

mardi 4 juin 2013 à 22:16

The Urban Dictionary website is pretty useful when one wants to know the meaning of any familiar or slang word. Users can write definitions for any words, and upvote or downvote them. Unfortunately, the website doesn’t have a public API, and I couldn’t find a command-line tool for it. So I wrote one.

Introducing ud

ud is a command-line tool which prints definitions from the Urban Dictionary website. It’s written in Ruby, and allows you to quickly search for a definition of any word.

$ ud wth
* WTH (567/126):

   1) Abbreviation for "What the Hell"
   2) Shortened alternative to "With"

 Example:
   1) WTH was that?!
   2) I ate some crackers wth chicken
(…)

For common abbreviations like “wtf” or “omg”, there are dozens of definitions, with minor differences. That’s why the script scraps only the first page of results, and supports a few options: -n allows you to limit the number of definitions (e.g. -n 1 → only one). -r allows you to select only the definitions which have an upvotes/downvotes ratio higher than what you want, e.g. -r 2 will select only the definitions which have twice more upvotes than downvotes. For your convenience, it also support the shortcut -u which is an alias for -r 2. Type ud -h for more info.

Install

That’s easy:

gem install ud

Please note that if you’re using Windows, you’ll need to install the Win32 Console ANSI gem for the colored output. Install it with:

gem install win32console

Using the UD module

The gem also provide a UD module, which you can use to query the website in your own Ruby code:

require 'ud'

wtf = UD.query 'wtf', :count => 1

puts wtf[0].keys.join ', '
#=> id, word, definition, example, upvotes, downvotes

Get the Urban Dictionary in your terminal

mardi 4 juin 2013 à 22:16

The Urban Dictionary website is pretty useful when one wants to know the meaning of any familiar or slang word. Users can write definitions for any words, and upvote or downvote them. Unfortunately, the website doesn’t have a public API, and I couldn’t find a command-line tool for it. So I wrote one.

Introducing ud

ud is a command-line tool which prints definitions from the Urban Dictionary website. It’s written in Ruby, and allows you to quickly search for a definition of any word.

$ ud wth
* WTH (567/126):

   1) Abbreviation for "What the Hell"
   2) Shortened alternative to "With"

 Example:
   1) WTH was that?!
   2) I ate some crackers wth chicken
(…)

For common abbreviations like “wtf” or “omg”, there are dozens of definitions, with minor differences. That’s why the script scraps only the first page of results, and supports a few options: -n allows you to limit the number of definitions (e.g. -n 1 → only one). -r allows you to select only the definitions which have an upvotes/downvotes ratio higher than what you want, e.g. -r 2 will select only the definitions which have twice more upvotes than downvotes. For your convenience, it also support the shortcut -u which is an alias for -r 2. Type ud -h for more info.

Install

That’s easy:

gem install ud

Please note that if you’re using Windows, you’ll need to install the Win32 Console ANSI gem for the colored output. Install it with:

gem install win32console

Using the UD module

The gem also provide a UD module, which you can use to query the website in your own Ruby code:

1
2
3
4
5
6
require 'ud'

wtf = UD.query 'wtf', :count => 1

puts wtf[0].keys.join ', '
#=> id, word, definition, example, upvotes, downvotes