- There are some situations that are difficult to distinguish mechanically, so I now consider all of those cases problematic, even when they are not obviously wrong.
- You should be coding for readability and error resistance.
- The place to express yourself in programming is in the quality of your ideas, and the efficiency of execution. The role of style is the same as in literature. A great writer doesn't express himself by putting the spaces before his commas instead of after, or by putting extra spaces inside his parentheses.
- Many people think they have good reasons for doing things badly.
- [The purpose of JSLint is not to make you feel good about inadequate coding standards.](http://tech.groups.y
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
#!/usr/bin/python3.1 | |
# This is script that extracts the trees of two commits to temporary | |
# directories and then runs meld on both directories, so you can compare | |
# them using meld's nice recursive browsing interface. | |
# | |
# This is for an answer to this question: | |
# http://stackoverflow.com/questions/2006032/view-differences-of-branches-with-meld | |
from subprocess import call, Popen, PIPE, check_call |
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
from flask import Flask, request | |
from gevent.event import AsyncResult | |
from gevent.wsgi import WSGIServer | |
app = Flask(__name__) | |
waiters = [] | |
@app.route("/") | |
def main(): |
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
#!/usr/bin/env python | |
"""This is a demonstration of sharing file descriptors across processes. | |
It uses Tornado (need a recent post-2.0 version from github) and the | |
multiprocessing module (from python 2.6+). To run it, start one copy | |
of fdserver.py and one or more copies of testserver.py (in different | |
terminals, or backgrounded, etc). Fetch http://localhost:8000 and | |
you'll see the requests getting answered by different processes (it's | |
normal for several requests to go to the same process under light | |
load, but under heavier load it tends to even out). |
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
from dns.resolver import Resolver, query, NXDOMAIN | |
import dns.query | |
from dns.exception import Timeout | |
from dns.message import make_query | |
from dns.rdatatype import NS | |
import socket | |
from random import choice | |
def get_zone_nameservers(zone): | |
nss = [] |
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
# Dynamically load virtualenvwrapper functions to reduce shell startup | |
# time. | |
# | |
# Copyright 2012 Aron Griffis <aron@arongriffis.com> | |
# Released under the GNU GPL v3 | |
####################################################################### | |
# Python virtualenvwrapper loads really slowly, so load it on demand. | |
if [[ $(type -w workon) != "workon: function" ]]; then | |
virtualenv_funcs=( workon deactivate mkvirtualenv ) |
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
set rnu | |
au BufEnter * :set rnu | |
au BufLeave * :set nu | |
au WinEnter * :set rnu | |
au WinLeave * :set nu | |
au InsertEnter * :set nu | |
au InsertLeave * :set rnu | |
au FocusLost * :set nu | |
au FocusGained * :set rnu |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
##git mergetool
In the middle file (future merged file), you can navigate between conflicts with ]c
and [c
.
Choose which version you want to keep with :diffget //2
or :diffget //3
(the //2
and //3
are unique identifiers for the target/master copy and the merge/branch copy file names).
:diffupdate (to remove leftover spacing issues)
:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)
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
// get handle to build output | |
def config = new HashMap() | |
def bindings = getBinding() | |
config.putAll(bindings.getVariables()) | |
def out = config['out'] | |
for (aSlave in hudson.model.Hudson.instance.slaves) { | |
// check if executor is dead | |
execList = aSlave.getComputer().getExecutors() | |
for( exec in execList ) { |
OlderNewer