This file contains 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
class Fab(object): | |
def __enter__(self): | |
self._stack = [] | |
return self | |
def __exit__(self, *args, **kwargs): | |
print self._stack | |
def __call__(self, *args): | |
self._stack += args |
This file contains 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
import logging | |
import os | |
import signal | |
import sys | |
def when_ready(server): | |
def monitor(): | |
modify_times = {} | |
while True: | |
for module in sys.modules.values(): |
This file contains 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
// new node.js tls api | |
var tls = require('tls'); | |
var fs = require('fs'); | |
var options = { | |
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), | |
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') | |
}; | |
var server = tls.createServer(options, function (s) { |
This file contains 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
command! -nargs=* Only call CloseHiddenBuffers() | |
function! CloseHiddenBuffers() | |
" figure out which buffers are visible in any tab | |
let visible = {} | |
for t in range(1, tabpagenr('$')) | |
for b in tabpagebuflist(t) | |
let visible[b] = 1 | |
endfor | |
endfor | |
" close any buffer that are loaded and not visible |
This file contains 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 | |
# First, open up GitX | |
# cd ~/Code/Python/django-haystack; gitx | |
tmux start-server | |
tmux new-session -d -s ProjectName -n git | |
tmux new-window -tProjectName:1 -n test | |
tmux new-window -tProjectName:2 -n solr | |
tmux new-window -tProjectName:3 -n runserver | |
tmux new-window -tProjectName:4 -n utility |
The generated-pth.py is what is created when installing a namespace package. These files are loaded on the auto-import of the site module to make sure Python knows where to find everything. There's a slight bug in this, however, that causes a problem. What happens if you have an __init__.py
file in one of the directories along the way?
We ran into this in Armstrong creating our armstrong.apps.audio.backends.*
packages. The code that's checks to see if there's an __init__.py
in the directory, and if there is it doesn't pre-populate it with a fake module. The problem is that those modules might not actually be imported and loaded yet. See where this is going yet?
This code creates the following in sys.modules
:
sys.modules["armstrong"] = types.ModuleType("armstrong")
sys.modules["armstrong"].apps = types.ModuleType("armstrong.apps")
This file contains 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
var snail = '@__y' | |
, progress = 0 | |
, pad = function(x) { var str = []; for(var i = 0; i < x; ++i) { str.push(' ') }; return str.join('') } | |
var interval = setInterval(function() { | |
++progress | |
progress >= 100 && | |
(progress = 0) | |
process.stdout.write('\r') |
This file contains 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
# This formula provide NodeJS v0.5.9 for Mac Homebrew | |
# | |
# Install this node-unstable.rb file in your `brew --prefix` directory | |
# Then: | |
# $ brew install node-unstable | |
# | |
# Formula was uploaded originally for v0.5.7 originally at: | |
# https://raw.github.com/bramswenson/homebrew/94c4104e50a95c111710ab7bc52cc2f7417db712/Library/Formula/node-unstable.rb | |
# | |
# Unfortunately, NodeJS 0.5.7 or 0.5.8 do not provide child_process.fork() |
This file contains 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
$red: #B12125 | |
$ltred: #DC8B6A | |
$dkblue: #3E67B0 | |
$blue: #44ABDF | |
$yellow: #FCC10F | |
$ltyellow: #FCE598 | |
$teal: #379D92 | |
$ltteal: #9BCEC8 | |
$violet: #742E66 | |
$ltviolet: #993D88 |
OlderNewer