Skip to content

Instantly share code, notes, and snippets.

eculver / wd-grid-view-overrides.js
Last active Aug 29, 2015
Script to override Wiredrive Wordpress plugin's grid-view with larger images.
View wd-grid-view-overrides.js
// create timeout to make sure it runs last
setTimeout(function () {
$(".wd-thumbnail").css('background-image', 'none').css({'width': 238, 'height': 144});
$(".wd-thumbnail img").css({'width': 238, 'height': 144}).show();
}, 200);
eculver / randhash
Last active Aug 29, 2015
One-liner to get a random character string for use in fixtures or mocking.
View randhash
alias randhash='python -c "import md5; from datetime import datetime; print\"%s\")).hexdigest()"'
View gist:8791514
* Example Module in RequireJS
], function () {
Ember.Application.initializer(ret = {
View sample_asset.json
"thumb": {
"href": "",
"width": 80,
"height": 80,
"asset": {
"id": 342393,
"title": "Client Commercial",
"filename": "mycommercial.m4v",
eculver /
Created Dec 26, 2013
Replace default Ubuntu apt repository URLs w/ DigitalOcean's
sudo sed -i "s/archive\.ubuntu/mirrors.digitalocean/g" /etc/apt/sources.list
eculver /
Last active Dec 29, 2015
Example of deleting a cached KVStore instance that sorl.thumbnail thumbnail templatetag creates. Pretty edge, but handy when thumbnails aren't being generated for whatever reason.
from sorl.thumbnail import default
from myapp.models import MyModel
# Get an model instance that has a File/ImageField associated with it. In this
# case the `thumb` attribute is an ImageField that we'd like to generate thumbnails for.
m = MyModel.objects.get(pk=10)
# Note the options passed to this method -- they are applied to the cache key so
# the ImageFile instance that is returned will be different for a different set
# of options kwargs provided here. In this case, the only option is `upscale=False`.
eculver /
Last active Dec 28, 2015
# This should be in a global namespace shared across your entire project
from django.conf import settings
NO_SETTING = ('!', None)
class TestSettingsManager(object):
A class which can modify some Django settings temporarily for a
test and then revert them to their original values later.
# create user
CREATE USER myuser WITH PASSWORD 'mypassword';
# create database
# grant access to user
# grant just create
View virtenv
# This is a simple wrapper for generating commands for executables within a
# python virtualenv.
# Usage: virtenv env-name command [arg, arg, ...]
# env-name The name of the virtualenv for the command to be run in.
# command The command within the virtualenv's path to be run. The base path is usually $VIRTUALENV_HOME/$VIRTUALENV/bin.
# arg Any remaining arguments are passed to the command itself.
eculver / app-config.js
Created Nov 4, 2013
This is an example of how we have set up our Ember.js application to use Require modules. The files below should be represented in this directory structure:
View app-config.js
// We generate this file with Grunt based on system/environment level configuration that is contained elsewhere... YAML file, build number, etc.
(function (exports) {
exports.config = {
"appVersion": "dev",
"cdnUrl": ""
// this last bit allows the config to be used both in the browser and in Node (Grunt)
}(typeof exports === 'undefined' ? this['WD'] = {}: exports));