This guide assumes a fresh install of Mac OSX 10.7 Lion.
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/
This article is now published on my website: Prefer Subshells for Context.
#!/usr/bin/python | |
# | |
# Copyright (c) 2012 Dave Pifke. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to | |
# deal in the Software without restriction, including without limitation the | |
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
# sell copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: |
This playbook has been removed as it is now very outdated. |
package tests | |
import ( | |
"testing" | |
) | |
type S struct { | |
t *testing.T | |
} |
package fakeresponse | |
import ( | |
"testing" | |
"net/http" | |
) | |
type FakeResponse struct { | |
t *testing.T | |
headers http.Header |
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
-
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the
secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection. -
Use production SSL certificates locally. This is annoying
#!/bin/bash | |
file=$1 | |
test -z $file && echo "file required." 1>&2 && exit 1 | |
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all | |
git ignore $file | |
git add .gitignore | |
git commit -m "Add $file to .gitignore" |
import requests | |
jogos = requests.get('http://worldcup.sfg.io/matches').json() | |
for jogo in jogos: | |
if jogo['status'] in ('completed', 'in progress'): | |
print (jogo['home_team']['country'], jogo['home_team']['goals'], 'x', | |
jogo['away_team']['country'], jogo['away_team']['goals']) |