Skip to content

Instantly share code, notes, and snippets.

@julescarbon
julescarbon / gist:2776598
Created May 23, 2012 17:41
view-serving main.py
#!/usr/bin/env python
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
import urllib2
import os
class MainHandler (webapp.RequestHandler):
def get (self):
# Set the cross origin resource sharing header to allow AJAX
@julescarbon
julescarbon / gist:2776771
Created May 23, 2012 18:12
our hangout bootstrap.js
/**
* app.js -- bootstrap so we can test different things ourselves
*/
var PRODUCTION_HOST = '//your-production-host.appspot.com',
DEVELOPMENT_HOST = 'localhost',
DEVELOPMENT_PORT = '8001';
var views = [
"test",
@julescarbon
julescarbon / gist:2776795
Created May 23, 2012 18:16
hangout API test.html
<script type="text/javascript">
Bootstrap.javascript("/assets/javascripts/test.js");
</script>
<br>
<input type="text" id="message"> <input type="button" value="Send!" id="send"/>
<br>
Received: <span id="receive"></span>
<br>
@julescarbon
julescarbon / gist:2776828
Created May 23, 2012 18:22
hangout API test.js
// Tests state changes and message passing
var StateTest = {
'_pingTime': 0,
'init': function(){
$("#message").keydown(StateTest.send);
$("#send").click(function(){
StateTest.send({'keyCode': 13});
});
@julescarbon
julescarbon / gist:2779360
Created May 24, 2012 04:06
leemon passphrase generator (decoded)
// beautiful.. http://www.leemon.com/crypto/MakePass.html
// this is the html-entity-encoded onchange event
// decoded with http://www.strictly-software.com/htmlencoder
//XOR the current time and last key pressed into the entropy pool, and hash it
fingerprint[0] ^= (t.z.value=='' || t.z.value==null || t.z.length==0) ? 0 : t.z.value.charCodeAt(t.z.value.length-1);
fingerprint[1] ^= (new Date()).getTime();
fingerprint[2] ^= nBits;
fingerprint[3] ^= nPass;
//t.z.value=hexFingerprint();
@julescarbon
julescarbon / gist:3900714
Created October 16, 2012 17:25
bookmarklet: bare directory listing image bomb
javascript:(function(){
var az = document.getElementsByTagName("a");
for (var i in az) {
az[i].innerHTML = "<img src='" + az[i].href + "'>";
}
})()
@julescarbon
julescarbon / gist:3900730
Created October 16, 2012 17:29
bookmarklet: strip commas #textmeme
javascript:(function () {
function getTextNodesIn(node, includeWhitespaceNodes) {
var textNodes = [], whitespace = /^\s*$/;
function getTextNodes(node) {
if (node.nodeType == 3) {
if (includeWhitespaceNodes || !whitespace.test(node.nodeValue)) {
textNodes.push(node);
}
} else {
for (var i = 0, len = node.childNodes.length; i < len; ++i) {
@julescarbon
julescarbon / gist:3908103
Created October 17, 2012 20:52
The code tag as it was intended
<script>$($("code").each(function(){ $(this).html( $(this).html().replace(/</g,"&lt;") ) }))</script>
<code>
<i>i buy water</i>
</code>
@julescarbon
julescarbon / gist:3908811
Created October 17, 2012 22:43
condensed description example
<style>
.short { display: block; }
.short .more { font-weight: bold; cursor: pointer; }
.long { display: none; }
.long .less { font-weight: bold; cursor: pointer; }
</style>
{{#events}}
<p>{{name}}</p>
<span class="description">
@julescarbon
julescarbon / moodify.js
Created March 17, 2013 21:15
Bookmarklet, turns all image links in an Apache directory listing into IMG tags. Examples: http://cd.textfiles.com/gifsgalore/GIFS/ABSTRACT/ http://www.tommoody.us/images/may08/
javascript:(function(){var az = document.getElementsByTagName("a"); for (var i in az) { az[i].innerHTML = "<img src='" + az[i].href + "'>"; } })()