A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| server { | |
| listen 80; | |
| server_name localhost; | |
| root /Users/YOUR_USERNAME/Sites; | |
| access_log /Library/Logs/default.access.log main; | |
| location / { | |
| include /usr/local/etc/nginx/conf.d/php-fpm; | |
| } |
| #ack is a tool like grep, designed for programmers with large trees of heterogeneous source code | |
| #to install ack, see http://betterthangrep.com/ | |
| #to use ack, launch terminal (mac osx) and type 'ack <some_keywords>' | |
| #ack will search all files in the current directory & sub-directories | |
| #here's how I have my config file setup. this file is located on mac osx here | |
| # ~/.ackrc | |
| # Always sort the files |
| package com.example.repository | |
| import com.example.domain.Customer | |
| import org.apache.ibatis.annotations.Delete | |
| import org.apache.ibatis.annotations.Insert | |
| import org.apache.ibatis.annotations.Mapper | |
| import org.apache.ibatis.annotations.Param | |
| import org.apache.ibatis.annotations.Select | |
| import org.apache.ibatis.annotations.SelectKey | |
| import org.apache.ibatis.annotations.Update |
| // @see https://stackoverflow.com/questions/1327074/how-to-execute-in-sql-queries-with-springs-jdbctemplate-effectivly | |
| Set<Integer> ids = ...; | |
| MapSqlParameterSource parameters = new MapSqlParameterSource(); | |
| parameters.addValue("ids", ids); | |
| List<Foo> foo = getJdbcTemplate().query("SELECT * FROM foo WHERE a IN (:ids)", | |
| parameters, getRowMapper()); |
| public void printClientInfo(HttpServletRequest request) { | |
| final String referer = getReferer(request); | |
| final String fullURL = getFullURL(request); | |
| final String clientIpAddr = getClientIpAddr(request); | |
| final String clientOS = getClientOS(request); | |
| final String clientBrowser = getClientBrowser(request); | |
| final String userAgent = getUserAgent(request); | |
| logger.info("\n" + |
| IE6 Only | |
| ================== | |
| _selector {...} | |
| IE6 & IE7 | |
| ================== | |
| *html or { _property: } | |
| IE7 Only | |
| ================== |
| #!/bin/sh | |
| # check for where the latest version of IDEA is installed | |
| IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1` | |
| wd=`pwd` | |
| # were we given a directory? | |
| if [ -d "$1" ]; then | |
| # echo "checking for things in the working dir given" | |
| wd=`ls -1d "$1" | head -n1` |
| # First: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| #go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
var Article = require('../../../models/article');Those suck for maintenance and they're ugly.