-
Recent Posts
Archives
- April 2023
- February 2023
- June 2021
- April 2019
- October 2017
- March 2017
- November 2016
- July 2016
- December 2015
- September 2015
- June 2015
- October 2014
- September 2014
- June 2014
- March 2014
- January 2014
- December 2013
- November 2013
- July 2013
- March 2013
- February 2013
- January 2013
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
Tag Archives: api
Securing the bacon
Later this year, we’ll be switching the site over to HTTPS only, instead of both HTTP and HTTPS as it is now. If you use the site in a browser, this should not have any impact on you, but if you have an API that is using HTTP, you’ll want to get that updated to use HTTPS.
What does the cow say?
kinda mean, but…
curl -s https://t.co/EKhF61NylP?type=all-meat¶s=1 | cowsay pic.twitter.com/O4y3vFUuCv— James Basoo (@JBasoo) July 21, 2016
Props to @JBasoo for this little tidbit.
Now it’s even easier to bulk generate posts using WP-CLI
A few months ago, we published a blog posts on how to bulk generate posts using the WP-CLI and the Bacon Ipsum API. Well, now it’s even faster and easier.
The latest release of the Any Ipsum plugin has WP-CLI support built-in to generate posts with filler content. First, install and activate the plugin from the command-line. By default, the plugin comes with Bacon Ipsum filler content.
wp plugin install any-ipsum --activate
Then, use the new any-ipsum generate-posts
command to generate posts. It defaults to ten posts, but you can pass in the number of posts to generate if you want more or fewer.
wp any-ipsum generate-posts
Boom, instant filler content.
There are several options, so check out wp help any-ipsum generate-posts
for a full list of what you can do with it. Enjoy!
Updates to the API
We have some new updates to the Bacon Ipsum API:
New formats: ‘text’ and ‘html’ if you need responses in something other than the default JSON format. Ex: https://baconipsum.com/api/?type=all-meat&start-with-lorem=1&format=html (Thanks to Shawn Hooper for new formats).
Ranges for paragraphs: Need to generate a random number of paragraphs? We support that now, just put the range in the paras parameter, ex: paras=3-7 https://baconipsum.com/api/?type=all-meat&start-with-lorem=1¶s=3-7
These same updates have been made to the Any Ipsum WordPress plugin.
Chromed Bacon
In an effort to give you as many ways as possible to make your filler text even meatier, we whipped up a simple Chrome App for generating bacon ipsum text. Source is also available on GitHub.
Meaty Social Politics
If you’re sick of the constant political drivel on Facebook, check out the Meaty Social Politics extension for Chrome that @WhiteyOmits whipped up. It changes instances of ‘Obama’, ‘Romney’, ‘Election’, etc. into paragraphs of bacon ipsum via our API.
It also has a snazzy icon. Well done sir!
P.S. I don’t care who you vote for, but you should still go vote.
API and jQuery Plugin updates
I’ve added support to the JSON API so you can generate one or more sentences of bacon ipsum rather than always generating paragraphs of text. Just pass ‘sentences=x’ as a parameter.
For example: http://baconipsum.com/api/?type=meat-and-filler&sentences=1
The jQuery plugin has also been updated to support sentences.
All the source code goodness has also been posted to GitHub if you want to dig into it a little more. Enjoy!
Git some bacon
Want to implement your own ‘insert-something-witty-here’ ipsum generator? Then head on over to our GitHub repository and take a look at the code that runs baconipsum.com. The BaconIpsumGenerator class is straight PHP code that can easily be modified to work as you see fit. I’ll be refactoring this code a bit since the Make_Some_Meaty_Filler method is wrapping stuff in HTML and it really should return an array of paragraphs and sentences so the API code can handle it better. It’s on my to-do list.
I also spent some time this weekend writing proper WordPress plugins for the site. Previously, the home page’s form was hacked into the WP theme, and the API was just a standalone directory with a PHP page. Now they’re both plugins and run based on WP actions & shortcodes. It really shouldn’t affect what you see on the site at all, but it makes me feel warm & fuzzy to have it coded properly now.
Enjoy!
jQuery Plugin
I whipped up a little Bacon Ipsum jQuery plugin that uses our API to generate some meaty goodness. When you’re mocking up a design, now you can use this plugin in your HTML rather than static text.
You can reference the plugin from our server or download it and use it locally.
http://cdn.baconipsum.com/api/jquery-BaconIpsum.js
The easiest way to use it is just to call the method with no options.
$('#placeholder').BaconIpsum();
You can also pass in options.
$('#placeholder).BaconIpsum({ type:'all-meat', paras:5, start_with_lorem:false });
$('#placeholder).BaconIpsum({ type:'meat-and-filler', sentences:1, start_with_lorem:true });
- type: either ‘all-meat’ or ‘meat-and-filler’
- paras: number of paragraphs
- sentences: number of sentences (this overrides paragraphs)
- start_with_lorem: true or false to start the text with ‘Bacon ipsum dolor sit amet’
- no_tags: true or false, pass true to not wrap the return value in <p> tags
- set_value: sets the element value rather than appending
There’s a sample page on GitHub with some example code.
I don’t always test my code
I happy rolled out the API, did some basic testing and it all worked fine, but it was all from within the API’s own page. Sure enough, external calls weren’t working. I’ve done some tweaks to the PHP code and the sample code so it should all be working now.