Skip to content

Instantly share code, notes, and snippets.

View amundo's full-sized avatar
🫥
(0)

Patrick Hall amundo

🫥
(0)
  • Massachusetts
  • 01:21 (UTC -12:00)
View GitHub Profile
/*
highlight v3 !! Modified by Jon Raasch (http://jonraasch.com) to fix IE6 bug !!
Highlights arbitrary terms.
<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
MIT license.
@amundo
amundo / html2text.py
Created May 14, 2011 05:36
unescape hex entities in html
#!/usr/bin/env python
"""html2text: Turn HTML into equivalent Markdown-structured text."""
__version__ = "2.35"
__author__ = "Aaron Swartz ([email protected])"
__copyright__ = "(C) 2004-2008 Aaron Swartz. GNU GPL 3."
__contributors__ = ["Martin 'Joey' Schulze", "Ricardo Reyes"]
# TODO:
# Support decoded entities with unifiable.
# Relative URL resolution
@amundo
amundo / wordcount.html
Created August 26, 2011 01:54
trying to figure out hwo to make events do something
<!DOCTYPE html>
<html>
<head>
<title>events</title>
<meta charset="UTF-8">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.1.7/underscore-min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.5.3/backbone-min.js"></script>
<script>
@amundo
amundo / prefix_filenames.py
Created October 20, 2011 04:23
Add a prefix to all the filenames in a directory
from glob import glob
import os
files = glob('*.txt')
for file in files:
os.rename( file, 'brad_' + file )
from collections import Counter
text = open('Texts.txt').read().decode('utf-8')
lines = text.splitlines()
besemah = []
for line in lines:
if line.startswith('\\tx') and line.strip() != '\\tx':
besemah.append(line)
@amundo
amundo / backbone-tutorial.js
Created December 18, 2011 19:31 — forked from jacob414/backbone-tutorial.js
Minimal example of data handling in Backbone.js
/* Scaled-down Backbone.js demonstration
* By Jacob Oscarson (http://twitter.com/jacob414), 2010
* MIT Licenced, see http://www.opensource.org/licenses/mit-license.php */
$(function() {
window.ulog = function(msg) { $('#log').append($('<div>'+msg+'</div>')); }
// Faking a little bit of Backbone.sync functionallity
Backbone.sync = function(method, model, succeeded) {
ulog('<strong>'+method + ":</strong> " + model.get('label'));
if(typeof model.cid != 'undefined') {
@amundo
amundo / letters.py
Created March 2, 2012 18:53
letters.py - command line tool to look up the name of Unicode characters in a text
#!/usr/bin/env python
"""
[email protected]
Do Whatever the Fuck You Want To License
http://sam.zoy.org/wtfpl/
letters - cat some UTF-8 text to this script, and
it will output the unicode name of the characters in the text, if
@amundo
amundo / index.html
Created April 2, 2012 06:03 — forked from bunkat/index.html
Swimlane Chart using d3.js
<html>
<head>
<title>Swimlane using d3.js</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="randomData.js"></script>
<style>
.chart {
// shape-rendering: crispEdges;
}
@amundo
amundo / image_labeler.html
Created April 4, 2012 08:12
A simple client-side image labeler. Very crude atm, but no jQuery necessary, just a recent browser!
<!DOCTYPE html>
<html>
<head>
<title>image</title>
<link rel=stylesheet href=style.css />
<meta charset="utf-8"/>
</head>
<body>
<p><label>Add image<input type="file" id="input"/></label></p>
<p><input type=text placeholder="add caption" id=caption /><button id=add_caption>add caption</button><button id=save>save</button></p>
@amundo
amundo / letters.py
Created June 11, 2012 03:16
look up names of characters in text
#!/usr/bin/env python
"""
[email protected]
Do Whatever the Fuck You Want To License
http://sam.zoy.org/wtfpl/
letters - cat some UTF-8 text to this script, and