Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
$ find -name "*.html" | xargs sed -i "s/{{ STATIC_URL }}\([^\"]\+\)/{% static '\1' %}/g" |
git diff --name-only | uniq | xargs mvim
When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.
Once you're in Vim, you can then switch between the files with :n
and :prev
, or another favourite: :w | n
(save current file and open the next command line-supplied file).
UPDATE: see below for a version that works with real terminal commands.
<!-- Raven.js Config --> | |
<script src="{{ JS_PATH }}/lib/raven.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
// Ignore list based off: https://gist.github.com/1878283 | |
var ravenOptions = { | |
// Will cause a deprecation warning, but the demise of `ignoreErrors` is still under discussion. | |
// See: https://github.com/getsentry/raven-js/issues/73 | |
ignoreErrors: [ | |
// Random plugins/extensions | |
'top.GLOBALS', |
--- content/browser/web_contents/web_contents_view_gtk.cc.orig 2013-03-09 20:16:51.437945192 -0500 | |
+++ content/browser/web_contents/web_contents_view_gtk.cc 2013-03-09 20:16:56.151278267 -0500 | |
@@ -56,6 +56,8 @@ | |
// See tab_contents_view_views.cc for discussion of mouse scroll zooming. | |
gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event, | |
WebContentsImpl* web_contents) { | |
+ return FALSE; | |
+ | |
if ((event->state & gtk_accelerator_get_default_mod_mask()) != | |
GDK_CONTROL_MASK) { |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" XF86AudioPlay | |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" XF86AudioStop | |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next" XF86AudioNext | |
"dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" XF86AudioPrevious |
#!/usr/bin/env python | |
import argparse | |
import re | |
import os | |
import subprocess | |
try: | |
import json | |
except ImportError: | |
import simplejson as json |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant::Config.run do |config| | |
# Base box to build off, and download URL for when it doesn't exist on the user's system already | |
config.vm.box = "wagtail-base-v0.1" | |
config.vm.box_url = "http://downloads.torchbox.com/wagtail-base-v0.1.box" | |
# You can also build from a vanilla precise32 box, although it'll take longer |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sublime_plugin | |
import subprocess | |
from time import sleep | |
import sys | |
cl = lambda line: subprocess.Popen(line, shell=True, stdout=subprocess.PIPE).communicate()[0].strip() | |
log = lambda message: sys.stderr.write("Log: %s\n" % message) |