Skip to content

Instantly share code, notes, and snippets.

@lhitchon
lhitchon / app.js
Created February 10, 2012 18:18
Gist node.js App
var http = require('http');
http.createServer(function (req, res) {
res.end("This is a gist app!");
}).listen( process.env.VCAP_APP_PORT);
@lhitchon
lhitchon / app.js
Created February 10, 2012 18:00
Deploy to AppFog form a Gist
var http = require('http');
http.createServer(function (req, res) {
res.end("Hello, world!");
}).listen( process.env.VCAP_APP_PORT || 8001 );
$services = json_decode(getenv("VCAP_SERVICES"),true);
@lhitchon
lhitchon / gist:1424751
Created December 2, 2011 20:41
PHP Mongo Test AppFog
<html>
<head>
<title>Demo</title>
</head>
<body>
<h1>PHP Mongo Test</h1>
<?php
$services = getenv("VCAP_SERVICES");
echo "<h2>VCAP_SERVICES</h2>";
echo "<p>" . $services . "</p>";
$mysql_config = $services["mysql-5.1"][0]["credentials"];
$db = mysql_connect( $mysql_config["hostname"],
$mysql_config["username"],
$mysql_config["password"]);
mysql_select_db( $mysql_config["name"] );