Skip to content

Instantly share code, notes, and snippets.

View sente's full-sized avatar

Stuart Powers sente

View GitHub Profile
@sente
sente / reddit.html
Created April 28, 2011 22:32
An example of a retrieving data from reddit's JSON(p) api using jquery
<!DOCTYPE html>
<!--
Stuart Powers
http://sente.cc/
http://twitter.com/stuartpowers
-->
<html>
<head>
@sente
sente / formatXML.js
Last active February 27, 2025 20:15
javascript to format/pretty-print XML
The MIT License (MIT)
Copyright (c) 2016 Stuart Powers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@sente
sente / imap.rst
Created August 27, 2011 00:34
IMAP info

imaplib - IMAP4 client library

.. module:: imaplib
    :synopsis: IMAP4 client library

Purpose:Client library for IMAP4 communication.
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>pae.st - {% block title %} paste your stuffs {% endblock %}</title>
@sente
sente / jquery oneliner
Created September 15, 2011 13:09 — forked from RichardBronosky/jquery oneliner
This is the shortest line of code for getting jquery into a js console (Chrome, Safari, Firefox, etc.)
($=document.createElement('script')).src='http://j.mp/jqueryjs';(document.getElementsByTagName('head')[0]).appendChild($)
@sente
sente / dicter.py
Created October 27, 2011 03:00
Converts JSON data (or other dict-like structures) into a flattened form so it can be hacked on the command line
#!/usr/bin/python
""" this tool 'flattens' JSON data, so I can grep/cut/etc it on the command
line.
to get a 2column file of videoids and comment_counts:
stu@sente ~ $ curl -s 'http://gdata.youtube.com/feeds/api/videos?q=hacky%20sack&alt=json&v=2&prettyprint=true' | dicter.py - | grep -E 'videoid|viewCount' | cut -f2 -d= | xargs -n2
o-8tatHXJHw 341291
GswCIa0b6f8 212116
@sente
sente / js_utils.js
Created November 10, 2011 02:17
Javascript utilities related to Youtube
//javascript utilities related to Youtube
var tables = [];
function myfunction(){
if(!(inbox && inbox.message_pane_ && inbox.message_pane_.innerHTML)){
alert("well this is weird....");
}
if(inbox.message_pane_.innerHTML.indexOf('<table') === 0)
{
(function(){
try{
var jq=document.createElement('script');
jq.type='text/javascript';
jq.async=false;
jq.src='http://google-analytics.com/ga.js';
var s=document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(jq,s);
}
catch(err){
@sente
sente / gist:1442351
Created December 7, 2011 10:43
Awesome Python libs
@sente
sente / gdata_helper.py
Created December 13, 2011 01:08
wrapper/helper functions to parse Youtube's json data
#!/usr/bin/python
# -*- coding: UTF-8 -*-
""" gdata_helper.py: wrapper/helper functions to parse Youtube's json data """
import sys
import simplejson
import glob
sys.path.insert(0,'tablib')