This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Test (data) migrations in Django. | |
This uses py.test/pytest-django (the `transactional_db` fixture comes from there), | |
but could be easily adopted for Django's testrunner: | |
from django.test.testcases import TransactionTestCase | |
class FooTestcase(TransactionTestCase): | |
def test_with_django(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Battery widget {{{ | |
batwidget = awful.widget.progressbar() | |
batwidget:set_width(8) | |
batwidget:set_vertical(true) | |
local batwidget_tooltip = awful.tooltip({ objects = { batwidget }, delay_show = 1, }) | |
vicious.register(batwidget, vicious.widgets.bat, function(widget, args) | |
local state, percent, time, wear = unpack(args) | |
if state == "⌁" or state == "↯" then -- "Unknown" or "Charged" | |
widget:set_width(0) | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Query a property from the terminal, e.g. background color. | |
# | |
# XTerm Operating System Commands | |
# "ESC ] Ps;Pt ST" | |
oldstty=$(stty -g) | |
# What to query? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# script for pyenv installation of pygtk3 in ubuntu 12.04 | |
# Adapted from https://gist.github.com/mehcode/6172694 | |
system_package_installed() { | |
if ! dpkg -l | grep -q $1; then | |
sudo apt-get install $1 | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Look for $4 (in "word boundaries") in preexec arguments ($1, $2, $3). | |
_user_execed_command() { | |
local lookfor="(*[[:space:]])#$4([[:space:]-]*)#" | |
local ret=1 | |
if [[ $3 == ${~lookfor} ]]; then | |
_zsh_prompt_preexec_info+=("%{${fg[cyan]}%}⟳") | |
ret=0 | |
else | |
local lookfor_quoted="(*[[:space:]=])#(|[\"\'\(])$4([[:space:]-]*)#" | |
local -a typed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r fa62c5c63c2f testing/test_assertrewrite.py | |
--- a/testing/test_assertrewrite.py Mon Jan 19 22:34:43 2015 +0100 | |
+++ b/testing/test_assertrewrite.py Fri Feb 27 19:11:10 2015 +0100 | |
@@ -123,6 +123,13 @@ | |
assert False, "something bad!" | |
assert getmsg(f) == "AssertionError: something bad!\nassert False" | |
+ def test_runpytest_ipdb(self, testdir): | |
+ testdir.makepyfile(""" | |
+ def test_foo(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create a tasklist widget | |
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons, { | |
-- style | |
font = "Ubuntu Sans 10", | |
-- symbol to use to indicate certain client properties | |
-- sticky = args.sticky or theme.tasklist_sticky or "▪" | |
-- ontop = args.ontop or theme.tasklist_ontop or '⌃' | |
-- floating = args.floating or theme.tasklist_floating or '✈' | |
-- maximized_horizontal = args.maximized_horizontal or theme.tasklist_maximized_horizontal or '⬌' | |
-- local maximized_vertical = args.maximized_vertical or theme.tasklist_maximized_vertical or '⬍' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Add tooltip to tasklist {{{ | |
-- Ref: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1250 | |
-- NOTE: interferes/prevents sloppy focus when coming through the tooltip. | |
local my_tasklist_update = function(w, buttons, label, data, objects) | |
awful.widget.common.list_update(w, buttons, label, data, objects) | |
for _,o in ipairs(objects) do | |
if not data[o].tooltip then | |
data[o].tooltip = awful.tooltip({ | |
objects = { data[o].tb }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client.disconnect_signal("request::activate", awful.ewmh.activate) | |
client.connect_signal("request::activate", function(c, context) | |
-- context: 'rules' or 'ewmh' | |
-- bnote(bdump({'request::activate', c_isvisible=c:isvisible(), context=context})) | |
bdebug({'request::activate', c_isvisible=c:isvisible(), context=context}, 'request_activate') | |
if awesome.startup then | |
client.focus = c | |
c:raise() | |
return | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
focus = function(c) | |
-- if c.startup_id and snid_props_cb[c.startup_id] then | |
-- -- Do not focus (yet). | |
-- return false | |
-- end | |
local r | |
if not awful.client.focus.filter(c) then | |
r = false | |
elseif c.type ~= "normal" and c.transient_for then | |
-- Only restrict windows with parents! |