Skip to content

Instantly share code, notes, and snippets.

View Faf4a's full-sized avatar
🐈
meow

Fafa Faf4a

🐈
meow
  • Inside Your Walls
  • 07:15 (UTC +02:00)
View GitHub Profile
@pixelbart
pixelbart / subreddits.js
Created May 18, 2016 11:00
Show an random image from a subreddit
// Place in your body:
// <div id="image"></div>
$(document).ready( function() {
var subreddit = 'VillagePorn'; // Your Subreddit without /r/
var aRandomNum = Math.floor((Math.random() * 25) + 1); // A random number - range 25
$.getJSON('http://www.reddit.com/r/'+subreddit+'.json?jsonp=?&show=all&limit=25', function(data) {
$.each(data.data.children, function(i,item){