Skip to content

Instantly share code, notes, and snippets.

View wnielson's full-sized avatar

Weston Nielson wnielson

View GitHub Profile
client = require('./client')
apirequest = require('../node_modules/googleapis/lib/apirequest')
get_alternate_videos = (docid, callback) ->
parameters = {
options: {
url: "https://docs.google.com/get_video_info?docid={docid}",
method: "GET"},
context: client.drive,
params: {
@wnielson
wnielson / hotswap.sh
Last active April 3, 2024 15:58
A very simple script that can be used to hot-swap an SATA device running in AHCI mode on Linux.
#!/bin/bash
#
# Usage:
#
# hotswap.sh [dev]
#
# Where [dev] is the name of the device such as "sda". Do not use
# partitions (like "sda1").
#
# Example:
@wnielson
wnielson / gist:3021699
Created June 30, 2012 01:31
get_latest_objects_by_category templatetag
diff --git a/categories/templatetags/category_tags.py b/categories/templatetags/category_tags.py
index 226a3ad..cddc8b9 100644
--- a/categories/templatetags/category_tags.py
+++ b/categories/templatetags/category_tags.py
@@ -1,4 +1,6 @@
from django import template
+from django.core.cache import cache
+from django.db import models
from django.template import Library, Node, TemplateSyntaxError, \
Variable, resolve_variable, VariableDoesNotExist, Context
diff --git a/media_tree/templates/admin/media_tree/filenode/mptt_change_list.html b/media_tree/templates/admin/media_tree/filenode/mptt_change_list.html
index d882dd3..c081f53 100644
--- a/media_tree/templates/admin/media_tree/filenode/mptt_change_list.html
+++ b/media_tree/templates/admin/media_tree/filenode/mptt_change_list.html
@@ -1,5 +1,5 @@
{% extends "admin/mptt_change_list.html" %}
-{% load adminmedia admin_list i18n mptt_tags media_tree_admin %}
+{% load adminmedia admin_list i18n mptt_tags media_tree_admin static %}
{% block extrahead %}
@wnielson
wnielson / hello.php
Created November 7, 2011 16:46
PHP_EOL example
<?php\n/**\n * A simple function to print "hello"\n *\n * @param string $name A name to say hello to\n *\n */\nfunction sayHello($name)\n{\n printf("Hello %s\\n", $name);\n}\n\n?>
diff --git a/chunks/templatetags/chunks.py b/chunks/templatetags/chunks.py
index 2b06cad..545b451 100644
--- a/chunks/templatetags/chunks.py
+++ b/chunks/templatetags/chunks.py
@@ -7,7 +7,7 @@ register = template.Library()
Chunk = models.get_model('chunks', 'chunk')
CACHE_PREFIX = "chunk_"
-def do_get_chunk(parser, token):
+def parse_chunk_args(parser, token):
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from dateutil import rrule
RRULE_WEEKDAYS = {"MO":0,"TU":1,"WE":2,"TH":3,"FR":4,"SA":5,"SU":6}
freqs = ( ("YEARLY", _("Yearly")),
("MONTHLY", _("Monthly")),
("WEEKLY", _("Weekly")),
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os
# Based off of Django's setup.py
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a