This article is now published on my website: Prefer Subshells for Context.
<?php | |
if (isset($_FILES['file'])) { | |
$file = $_FILES['file']; | |
// what the browser says | |
$type = $file['type']; | |
// what the file ready is | |
$finfo = new finfo(FILEINFO_MIME); | |
$file['mimetype'] = $finfo->file($file['tmp_name']); |
#!/usr/bin/env php | |
<?php | |
$app = function($request) { | |
$body = <<<EOS | |
<!DOCTYPE html> | |
<html> | |
<meta charset=utf-8> | |
<title>Hello World!</title> |
#!/usr/bin/ruby | |
# Require: | |
# - linux or Mac | |
# - ruby 1.8.7 | |
# - Gem soap4r | |
# - curl | |
# | |
# Usage : | |
# ruby ovhfact.rb 2011 | |
# |
#! /usr/bin/ruby | |
# | |
# A script to check Amazon Webservice's Health Status Dashboard | |
# | |
# Jens Braeuer, github.com/jbraeuer | |
# | |
# Version 1.0 | |
# |
# by default you only get 1000 objects at a time | |
# so you have to roll your own cursor | |
S3.connect! | |
objects = [] | |
last_key = nil | |
begin | |
new_objects = AWS::S3::Bucket.objects(bucket_name, :marker => last_key) | |
objects += new_objects |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:
Documentation
-
Accurate / up-to-date systems architecture diagram
-
Accurate / up-to-date network diagram
-
Out-of-hours support plan
-
Incident management plan
# How Clearance / Hoptoad does it | |
module Clearance | |
class << self | |
attr_accessor :configuration | |
end | |
def self.configure | |
self.configuration ||= Configuration.new | |
yield(configuration) | |
end |
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