Skip to content

Instantly share code, notes, and snippets.

@tofias
Created February 22, 2014 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tofias/9160634 to your computer and use it in GitHub Desktop.
Save tofias/9160634 to your computer and use it in GitHub Desktop.
Hipster Ipsum for Alfred (or similar)
#!/usr/bin/php
# Hipster Ipsum for Alfred
# https://gist.github.com/tofias/9160634
# using hipsteripsum.me (via API at hipsterjesus.com)
# based on https://github.com/sethlilly/Hipster-Ipsum-for-Coda
$COUNT = 1; # number of paragraphs 1-99
$HTML = "false"; # or 'true'
$TYPE = "hipster-centric"; # or 'hipster-latin'
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://hipsterjesus.com/api/?type=$TYPE&html=$HTML&paras=".$COUNT);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
error_log($res,0);
curl_close($ch);
$ret = json_decode($res);
echo $ret->{'text'};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment