Skip to content

Instantly share code, notes, and snippets.

View SyntaxC4's full-sized avatar
🏠
Working from home

Cory Fowler SyntaxC4

🏠
Working from home
View GitHub Profile
@SyntaxC4
SyntaxC4 / DeterminingStorageLocation
Created March 21, 2012 19:18
Determining if you're running on Storage Emulator or Windows Azure Storage Account
public ActionResult Index()
{
const string welcomeNote = "Welcome to ASP.NET MVC {0}!";
var account = CloudStorageAccount.Parse(
RoleEnvironment.
GetConfigurationSettingValue("DataConnectionString"));
ViewBag.Message = (account.BlobEndpoint.IsLoopback) ?
string.Format(welcomeNote, " on Local") :
// Developer: Cory Fowler
//
namespace Net.SyntaxC4.Helpers
{
using System.Configuration;
using Microsoft.WindowsAzure.ServiceRuntime;
/// <summary>
/// Provides a way of Providing Context between Cloud and On-Premise Deployment of an Application.
@SyntaxC4
SyntaxC4 / .user.ini
Last active October 12, 2020 14:52
Web.config Starter for PHP on Windows Azure Web Sites
upload_max_filesize = 12M
log_errors=1
@SyntaxC4
SyntaxC4 / index.php
Created July 26, 2012 07:42
Accessing Portal Set App Settings from PHP and Node.js
<html>
<head><title>Accessing App Settings from PHP</title></head>
<body>
<h1>Hello from <?php echo getenv("CloudProvider"); ?></h1>
<ul>
<li><label>Service Bus Namespace:</label> <?php echo getenv("ServiceBusConnectionString"); ?></li>
<li><label>Storage Connection String:</label> <?php echo getenv("StorageConnectionString"); ?>
</ul>
@SyntaxC4
SyntaxC4 / web.config
Created July 26, 2012 20:44
Setting up CakePHP on Windows Azure Web Sites
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
### Check me into the root of the repo
### as .gitattributes
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
@SyntaxC4
SyntaxC4 / array.php
Created August 29, 2012 10:05
PartitionKey or RowKey must satisfy is_string
array('1' => 'value1', '2' => 'value2');
@SyntaxC4
SyntaxC4 / breakBlobLease.js
Last active December 16, 2016 19:26
This code snippet will help break Blob Leases in Windows Azure Storage.
/*
* This code snippet will help break Blob Leases in Windows Azure Storage.
*
* I did not write this code, it was found at the website below.
*
* @see http://blogs.msdn.com/b/interoperability/archive/2012/08/01/node-js-script-for-releasing-a-windows-azure-blob-lease.aspx
*/
// updated 3/3/2014 for latest version of Azure CLI
// Import required modules from Windows Azure Cross Platform Tool's library
@SyntaxC4
SyntaxC4 / ServiceDefinition.csdef
Created September 29, 2012 05:19
Windows Azure Cloud Service or Web Site: Where am I Deployed?
<ServiceDefinition name="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRole1">
<Runtime>
<Environment>
<Variable name="WhereAmI" value="cloud" />
</Environment>
</Runtime>
</WebRole>
</ServiceDefinition>
@SyntaxC4
SyntaxC4 / wp-config.php
Created November 24, 2012 19:06
Custom WordPress WP-CONFIG.PHP MySQL section for use on Windows Azure Web Sites.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', getenv('WP_DB_NAME'));
/** MySQL database username */
define('DB_USER', getenv('WP_DB_USER'));
/** MySQL database password */
define('DB_PASSWORD', getenv('WP_DB_PASSWORD'));