Skip to content

Instantly share code, notes, and snippets.

View forlornhedgehog's full-sized avatar

Forlorn Hedgehog forlornhedgehog

  • A meadow somewhere
View GitHub Profile
@garcia
garcia / autotumble.py
Last active February 9, 2018 15:16
Automatically follow Tumblr users who post in the #follow-back tag and reblog posts from the Dashboard. Requires python-oauth2, a Tumblr blog, a Tumblr appication's consumer key/secret pair, and an authentication key/secret pair for the blog / application. Potentially useful for future social engineering escapades.
#!/usr/bin/env python
import itertools
import json
import logging
import sys
import time
import traceback
# oauth2 is available at https://github.com/simplegeo/python-oauth2
import oauth2
@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.
@cmfcmf
cmfcmf / Update, edit and develop Tumblr Theme dynamically.js
Last active July 29, 2019 15:39
Creating and developing own tumblr themes has always been a pitty. However, this single line of javascript will help you A LOT. Follow the instuctions in the first comment below to get your own live version of your theme.
setInterval(function(){jQuery.ajax('YOUR-URL-TO-THE-THEME-FILE',{cache:false}).success(function(html){var btn=jQuery("div[data-action='update_preview']").first();if(html!=ace.edit('editor').getValue()){ace.edit('editor').setValue(html);if(!btn.hasClass('disabled'))btn.click()}});},1000);