Skip to content

Instantly share code, notes, and snippets.

@marlun
marlun / fabfile.py
Created November 28, 2009 10:45 — forked from fiee/fabfile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
fabfile for Django
------------------
see http://morethanseven.net/2009/07/27/fabric-django-git-apache-mod_wsgi-virtualenv-and-p/
modified for fabric 0.9/1.0 by Hraban (fiëé visuëlle)
several additions, corrections and customizations, too
def method_name(param):
if param == true:
print "success"
else:
print "failure"
addAll: function () {
var tasks = '', view;
this.tasks.each(function (task) {
view = new TaskView({model: task});
tasks += (view.render().el);
});
this.$('#todo-body').append(tasks);
}
addAll: function () {
var tasks = [], view;
this.tasks.each(function (task) {
view = new TaskView({model: task});
tasks.push(view.render().el);
});
this.$('#todo-body').append(tasks.join(''));
}
#!/usr/bin/env python
import os
for f in os.listdir(os.getcwd()):
if os.path.isdir(f):
newname = f.replace(u'å', u'a')
os.rename(f, newname)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
for f in os.listdir(os.getcwd()):
if os.path.isdir(f):
newname = f.replace(u'å', u'a')
os.rename(f, newname)
inoremap <expr> <CR> pumvisible() ?
\ "\<C-Y>" : delimitMate#WithinEmptyPair() ?
\ "\<C-R>=delimitMate#ExpandReturn()\<CR>" : "\<C-G>u\<CR>"
" <CR> accepts selected completion menu item (if it's visible)
"inoremap <expr> <cr> pumvisible() ? "\<c-y>" : "\<c-g>u\<cr>"
" Simulate <down> button
inoremap <expr> <c-n> pumvisible() ? "\<lt>c-n>" : "\<lt>c-n>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>"
openProject: function(project) {
project.tasks.fetch({'success': function (tasks) {
mud.app.workspace.taskList.tasks.refresh(tasks.models);
}});
},
addAll: function () {
var tasks = [], view;
this.tasks.each(function (task) {
view = new TaskView({model: task});
tasks.push(view.render().el);
});
this.$('#todo-body').append(tasks);
}
var sys = require('sys'),
http = require('http'),
url = require('url'),
path = require('path'),
fs = require('fs'),
events = require('events');
function load_static_file(uri, response) {
var filename = path.join(process.cwd(), uri);
path.exists(filename, function (exists) {