- Code is under source control (git) with a remote I can read/write to
- Be aware of test coverage
- Code is under continuous integration
- The code has a known deployment process
| # c = CSVBuilder.new ['column 1 name', 'column 2 name', 'column 3 name'] | |
| # rowdata.each do |r| | |
| # special_column = r.boolean ? 'YES' : 'NO' | |
| # c.add_row [special_column, r.name, r.date] | |
| # end | |
| # c.export('optional_filename.csv') | |
| class CSVBuilder | |
| def initialize(head) | |
| if head.is_a?(Array) |
| ;; emacs configuration | |
| (push "/usr/local/bin" exec-path) | |
| (setq make-backup-files nil) | |
| (setq auto-save-default nil) | |
| (setq-default tab-width 2) | |
| (setq-default indent-tabs-mode nil) | |
| (setq inhibit-startup-message t) | |
| (setq tramp-default-method "scpx") |
| CURRENT=`pwd` | |
| mkdir /tmp/repo_archive | |
| cd /tmp/repo_archive | |
| git clone --quiet --bare "$CURRENT" repository | |
| tar -c repository | pigz --best > "$CURRENT/archive.tar.gz" | |
| cd $CURRENT | |
| rm -rf /tmp/repo_archive |
| class ExifData | |
| require 'celluloid' | |
| def initialize(file) | |
| raise 'Expects Upload!' unless file.is_a?(Upload) | |
| @upload = file | |
| end | |
| def process! | |
| # this is fictitional |
| # Configuration Constants (move to yaml ?) | |
| HOST = 'ad01.domain.local' | |
| PORT = 636 | |
| USER = 'administrator' | |
| PASS = 'password' | |
| BASE = 'dc=domain, dc=local' | |
| DOMAIN = 'domain.local' | |
| SCOPE = '(&(objectCategory=person)(objectClass=user))' | |
| require 'rubygems' |
| #!/bin/bash | |
| # Mac Bootstrap Script | |
| # (C) 2011 - @codatory | |
| # | |
| # "It might work for you, too." | |
| pretty_echo(){ | |
| echo '--------------------------------' | |
| echo " $*" |
| whatismyip() { | |
| IP=`curl --silent http://ip.appspot.com/` | |
| echo "External IP: ${IP}" | |
| } |
| file = params[:csv].open | |
| chardet = CharDet.detect(file.read[0..200]) | |
| if chardet['confidence'] > 0.7 | |
| charset = chardet['encoding'] | |
| else | |
| raise 'Unable to detect file encoding' | |
| end | |
| csv = CSV.parse(Iconv.conv('ASCII//IGNORE//TRANSLIT',charset,file.open.read), :headers => true) |
| development: | |
| adapter: sqlite3 | |
| database: db/development.sqlite3 | |
| timeout: 5000 | |
| test: | |
| adapter: sqlite3 | |
| database: db/test.sqlite3 | |
| timeout: 5000 |