Skip to content

Instantly share code, notes, and snippets.

View mwarkentin's full-sized avatar
😃

Michael Warkentin mwarkentin

😃
View GitHub Profile
Request.Twitter = new Class({
Extends: Request.JSONP,
options: {
linkify: true,
url: 'http://twitter.com/statuses/user_timeline/{term}.json',
data: {
count: 5
}
@mwarkentin
mwarkentin / Mootools Class Template.js
Created January 15, 2010 20:01
A simple template for new Mootools classes from David Walsh.
var yourClass = new Class({
Implements: [Options],
options: {
yourOption: ''
},
initialize: function(options) {
this.setOptions(options);
},
class Event(models.Model):
# Setup event types
TYPE_OTHER = 0
TYPE_FUNERAL = 1
TYPE_WEDDING = 2
TYPE_CHOICES = (
(TYPE_OTHER, 'Other'),
(TYPE_FUNERAL, 'Funeral'),
(TYPE_WEDDING, 'Wedding'),
)
@mwarkentin
mwarkentin / gist:1112987
Created July 29, 2011 02:03
Vagrant Guest Additions Log
vagrant@lucid32:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-generic linux-image-generic
The following packages will be upgraded:
apt apt-transport-https apt-utils base-files bind9-host dhcp3-client dhcp3-common dnsutils fuse-utils initscripts libbind9-60 libcurl3-gnutls libdbus-1-3 libdns64 libfuse2
libgssapi-krb5-2 libisc60 libisccc60 libisccfg60 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.4-2 liblwres60 libpam-modules libpam-runtime libpam0g libparted0debian1
libpng12-0 linux-firmware linux-libc-dev login logrotate ntpdate parted passwd perl perl-base perl-modules python-apt rsync sysv-rc sysvinit-utils tzdata w3m xkb-data
@mwarkentin
mwarkentin / gist:1113680
Created July 29, 2011 11:58
Vagrant Error
vagrant@lucid32:~$ sudo apt-get install build-essential module-assistant linux-headers-$(uname -r) dkms
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
module-assistant is already the newest version.
The following extra packages will be installed:
linux-headers-2.6.32-28
Recommended packages:
linux-headers-2.6-686 linux-headers-2.6-amd64 linux-headers-generic linux-headers
@mwarkentin
mwarkentin / gist:1113706
Created July 29, 2011 12:19
Vagrant Error
vagrant@lucid32:~$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
linux-generic linux-image-generic
The following packages will be upgraded:
apt apt-transport-https apt-utils base-files bind9-host dhcp3-client dhcp3-common dnsutils fuse-utils initscripts libbind9-60 libcurl3-gnutls libdbus-1-3 libdns64 libfuse2
libgssapi-krb5-2 libisc60 libisccc60 libisccfg60 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.4-2 liblwres60 libpam-modules libpam-runtime libpam0g libparted0debian1
libpng12-0 linux-firmware linux-libc-dev login logrotate ntpdate parted passwd perl perl-base perl-modules python-apt rsync sysv-rc sysvinit-utils tzdata w3m xkb-data
@mwarkentin
mwarkentin / solo.rb
Created July 29, 2011 13:26
mwarkentin's vagrantfile
Vagrant::Config.run do |config|
# Base Ubuntu box
config.vm.box = "lucid32"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
@mwarkentin
mwarkentin / setFieldLabel.js
Created September 3, 2011 03:49
Sencha Touch setFieldLabel()
Ext.override(Ext.form.Field, {
setFieldLabel : function(text) {
if (this.rendered) {
this.el.down('.x-form-label').update(text);
}
this.fieldLabel = text;
}
});
@mwarkentin
mwarkentin / gist:1885686
Created February 22, 2012 15:59
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

⌘+X delete line
⌘+↩ insert line after
⌘+⇧+↩ insert line before
⌘+⇧+↑ move line (or selection) up
@mwarkentin
mwarkentin / json2csv.py
Created January 18, 2013 16:55
Convert a JSON datadump of a Django model into CSV format. Note: This only exports the fields dict, so you won't have pk in the output.
# -*- coding: utf-8 -*-
import codecs
import cStringIO
import csv
import json
import sys
"""
Convert Django json datadump fields into csv.