Skip to content

Instantly share code, notes, and snippets.

winhamwr / jquery.wymeditor.inlinestyler.js
Created Feb 27, 2012
Ghetto WYMeditor plugin to do inline styling
View jquery.wymeditor.inlinestyler.js
//Extend WYMeditor
WYMeditor.editor.prototype.inlineStyler = function(options) {
if(jQuery.browser.msie == true){
//No support
}else if (jQuery.browser.opera == true){
//No support
}else if (jQuery.browser.safari == true && jQuery.browser.version < 1.9){
//No support
var inlineStyler = new InlineStyler(options, this);
winhamwr / wym_autosave.js
Created Nov 1, 2011
Javascript to do autosave on a form using WYMeditor
View wym_autosave.js
Automatically saves a policy every REFRESH milliseconds through AJAX,
but only when the .autosave form has changed. To use, add the class autosave
to your form.
Note: REFRESH must always be bigger than SAVE_TIMEOUT, otherwise a broken
save will cause deadlock for pending.
function processJson(data) {
winhamwr / override.css
Created Aug 30, 2011
CSS style override for a large-screen board
View override.css
/** **/
ul.task_list {
height: 1024px;
ul.task_list li {
height: auto;
max-height: 20em;
winhamwr /
Created Aug 23, 2011
Stop a signal from running on a fixture-style load
def my_signal_handler(sender, instance, raw, **kwargs):
if raw:
# This is a fixture-style load. Don't run the handler
print "totally handling a signal"
winhamwr /
Created Aug 17, 2011
Script to put mysqld on a ram disk in ubuntu 10.04. Runs on every hudson slave boot
sudo cp -r /home/hudson/.ssh /root/;
sudo chown -R root:root /root/.ssh;
sudo service mysql stop;
sudo cp -pRL /var/lib/mysql /dev/shm/mysql;
sudo echo "[mysqld]
datadir = /dev/shm/mysql
" > /tmp/ramdisk.cnf;
sudo mv /tmp/ramdisk.cnf /etc/mysql/conf.d/ramdisk.cnf;
sudo echo "
winhamwr /
Created Aug 2, 2011
Nose generator tests example
from import assert_equal
addition_cases = [
'2 + 2',
winhamwr /
Created Jul 27, 2011
Fabric script to bundle an ami
def bundle_ami():
env.ami_name = env.hudson_slave_ami_name
winhamwr /
Created Jul 21, 2011
Python script to install some pip-based requirements reliably in a virtualenv
#! /usr/bin/env python
Update a set of virtualenvs based on a given set of pip requirements files
whenever those files change. Keeps track of requirements file changes by md5
hashing the files and storing that hash in the virtualenv. That means that
only updates to the files themselves will trigger updating (changes to a
repository won't be caught).
Optionally also supports uploading/downloading a full bundle of all requirements
to/from Amazon S3 based on the requirements hash in order to ensure that
winhamwr / jquery.wymeditor.spellcheck.js
Created Apr 19, 2011
WYMeditor plugin to provide spellchecking
View jquery.wymeditor.spellcheck.js
var spellcheck_type = 'google';
var correction_list = null;
// No constants for Node.* IE
var TEXT_NODE = 3;
WYMeditor.editor.prototype.spellcheck = function() {
if (!$.browser.msie) { return };
winhamwr / jquery.wymeditor.attachments.js
Created Apr 19, 2011
Jquery plugin for file upload and optional WYMeditor image insertion
View jquery.wymeditor.attachments.js
$.Attachments = {
defaults: {
editLoader: '<div class="contentLoading formloader"><img src="/site_media/images/loading.gif" alt="Loading data, please wait...">',
editLoaderS: 'div.formloader',
listLoader: '<div class="contentLoading listloader"><img src="/site_media/images/loading.gif" alt="Loading data, please wait...">',