Skip to content

Instantly share code, notes, and snippets.

View ara303's full-sized avatar

E ara303

  • uk
View GitHub Profile
@ara303
ara303 / instagram-widget.js
Last active December 22, 2015 10:19
Simple Instagram widget to get 2 most recent photos from an authenticated user
var count = 2; // How many photos do you wanna display
var igToken = "371393934.dba0291.7da640d4c8fc4ff3a205f2e290eae6f1"; // DON'T USE MY ACCESS TOKEN. Generate your own, http://instagram.com/developer
var igUserId = "371393934"; // This is easy to generate, I've made a thing http://themes.edada.ms/instagram-auth
$.ajax({
url: 'https://api.instagram.com/v1/users/'+igUserId+'/media/recent/?access_token='+igToken+'&callback=?',
data: {
'count': count
},
dataType: "jsonp",
@ara303
ara303 / tumblr-lightbox-for-photos.js
Last active December 5, 2018 10:31
Use Tumblr's built-in lightbox to display high resolution photos. I don't necessarily recommend using this anymore as it unnecessarily relies on jQuery, which you may not need. For a vanilla JS version, see: https://gist.github.com/edadams/5ce1ec3d0b1f69e80724af7eb3b606f4
Hey! Just to let you know there is a much better version of this script that doesn't require jQuery here:
https://gist.github.com/edadams/5ce1ec3d0b1f69e80724af7eb3b606f4
For posterity, and because this Gist got unexpectedly popular for a random code snippet, I will preserve the original below. Please do know that I've figured out a much better way to do this, which is above.
$(function(){ // shorthand document.ready()
$('.make_lightbox').each(function(){ // this is just an element I let them click, it carries a series of data- attributes.
$(this).on('click',function(){ // when clicked. this is the newer jQuery click() handler that's only in v1.8+ so that may be something to note.
var lbArray = []; // create blank array.
var arrayContents = {"width":$(this).data('width'), "height":$(this).data('height'), "low_res":$(this).data("lowres"), "high_res":$(this).data('highres')}; // make set of the data- attributes.