I love music and computers. Because of that, a lot of luck and a great team, a pretty sweet music store called Amie Street exists.
I love music and computers. Because of that, a lot of luck and a great team, a pretty sweet music store called Amie Street exists.
I use the shit out of Github Gists. I’ve been working on some javascript the past few days and wanted to post some code examples here using their embed script. However, Tumblr (like just about every other blog service that you dont self host) purifies your post text, stripping out script tags, embeds, etc because of security. However, you can usually add your own JS in your template code and then just use selectors to manipulate things the way you want.
I came across this ticket from @defunkt and tried emebdding things using an iframe and appending .pibb to my gist URL. I had my JS look for all gist links on the page, and then insert the iframe just after the link. This worked fine, but I wasn’t happy with the result because:
After throwing that out, I went back to my original plan which was figure out a way to get the gist with syntax highlighting into the page using JSONP and jQuery.getJSON. However, github like almost all services doesn’t support JSONP yet. But one of the only things I’ve found Pipes useful for is that it supports fetching content as a proxy and returning it as JSONP. Yes, I know it takes two minutes to set up your own proxy to fetch and wrap in a callback. However, I can just whip up a pipe like this and I’m already to go and I dont have to worry about maintaining it. Here’s the result.