Skip to content

Instantly share code, notes, and snippets.

@winhamwr
winhamwr / policystat_zendesk_uptime.html
Last active March 10, 2016 18:30
Zendesk home screen widget for displaying our uptime and satisfaction
<!------------------------------------------------------------------
Satisfied Customers / Application Uptime
------------------------------------------------------------------->
<!-- This code lives at: https://gist.github.com/winhamwr/5886065 Make all edits there, first -->
<style type="text/css" media="screen, projection">
@import url(https://policystat.zendesk.com/stylesheets/public_satisfaction.css);
.highlighted { color: #133672; }
.uptime-percentage {
font-weight: bold;
font-size: large;
@winhamwr
winhamwr / example-usage.html
Last active February 4, 2016 09:46
WYMeditor plugin for inserting "special" characters (HTML entities)
<html>
<head>
<link rel="stylesheet" type="text/css" href="wymeditor/skins/default/skin.css" />
</head>
<body>
<!-- Note: You'll need to put everything in a "plugins/special_chars" directory
and add your own "plugins/special_chars/char.gif" icon that will be used for the button. -->
<form>
<textarea class="my-wymeditor"></textarea>
</form>
@winhamwr
winhamwr / scale_wym.js
Created January 18, 2013 21:39
Scale WYMeditor when the window size changes
function scaleEditor(wym) {
var min_width = 675;
var max_width = 850;
var min_height = 300;
var max_height = 600;
var width = $(window).width() - 50;
width = Math.max(width, min_width);
width = Math.min(width, max_width);
@winhamwr
winhamwr / gist:3035439
Created July 2, 2012 20:18
zenbox integration
<!--[if gt IE 7]><!-->
<script type="text/javascript" src="//assets.zendesk.com/external/zenbox/v2.4/zenbox.js"></script>
<style type="text/css" media="screen, projection">
@import url(//assets.zendesk.com/external/zenbox/v2.4/zenbox.css);
</style>
<script type="text/javascript">
if (typeof(Zenbox) !== "undefined") {
Zenbox.init({
dropboxID: "XXXXXXX",
url: "https://policystat.zendesk.com",
@winhamwr
winhamwr / jquery.wymeditor.embed.js
Created June 19, 2012 19:46
WYMeditor embed plugin with video/source support
/**
* WYMeditor : what you see is What You Mean web-based editor
* Copyright (c) 2005 - 2009 Jean-Francois Hovinne, http://www.wymeditor.org/
* Dual licensed under the MIT (MIT-license.txt)
* and GPL (GPL-license.txt) licenses.
*
* For further information visit:
* http://www.wymeditor.org/
*
* File Name:
@winhamwr
winhamwr / tutorial.md
Created June 4, 2012 22:37
Creating a repeatable, dynamic site to site VPN with OpenSwan on Ubuntu 10.04 from Amazon EC2

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham winhamwr@gmail.com

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

@winhamwr
winhamwr / awesome_task.py
Created May 17, 2012 16:02
Celery base task that adds some niceties for longish-running or singleton jobs.
"""
Celery base task aimed at longish-running jobs that return a result.
``AwesomeResultTask`` adds thundering herd avoidance, result caching, progress
reporting, error fallback and JSON encoding of results.
"""
from __future__ import division
import logging
import simplejson
{% with table.rows as table_rows %}
{% autopaginate table_rows page_size %}
<table class="floating striped">
{% if max_matches %}
<caption>
<strong class="num_results">Over {{ max_matches }}</strong> Results
</caption>
{% else %}
@winhamwr
winhamwr / rotate_and_combine_frames.sh
Created April 8, 2012 19:01
Linux timelapse video scripts
#! /bin/bash
set -e;
set -x;
rm -rf build;
mkdir build;
echo "Rotating images";
find *.jpeg -type f -print | xargs -I {} convert {} -rotate 90 build/{};
echo "Building combined mp4"
rm -f time-lapse.mp4;
ffmpeg -i %06d.jpeg -r 30 -s hd480 -vcodec libx264 -vpre hq time-lapse.mp4;
@winhamwr
winhamwr / gist:2116251
Created March 19, 2012 15:28
WYMeditor customization example
$(document).ready(function() {
$('#id_doc-html').wymeditor(
{
jQueryPath: "https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",
wymPath: "/site_media/lib/wymeditor/wymeditor/jquery.wymeditor.js",
toolsItems: "[ {'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}, {'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}, {'name': 'Superscript', 'title': 'Superscript', 'css': 'wym_tools_superscript'}, {'name': 'Subscript', 'title': 'Subscript', 'css': 'wym_tools_subscript'}, {'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}, {'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}, {'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}, {'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}, {'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'}, {'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'}, {'name': 'InsertImage'