Skip to content

Instantly share code, notes, and snippets.

[assembly: FunctionsStartup(typeof(Startup))]
namespace MyFunctionsProject
{
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
// this will bind to the "Values" section of the configuration
builder
.Services
@aranm
aranm / ApplicationSettings.cs
Last active August 6, 2019 06:20
Application Settings and Connection Strings POCO
public class ApplicationSettings
{
public string AzureWebJobsStorage { get; set; }
public string SuperApiKey { get; set; }
}
public class ConnectionStrings
{
public string SqlConnectionString { get; set; }
}
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"SuperApiKey": "VERY_SECRET_SECURE",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
},
"ConnectionStrings": {
"SqlConnectionString": "MyConnectionString"
}
public interface IApplicationSettings
{
string Get(string key);
string Get(string key, string defaultValue);
}
@aranm
aranm / functions.cs
Last active August 6, 2019 06:27
Azure Functions with DI'd Application Settings
public class MyFunctions
{
private readonly IOptions<ApplicationSettings> _applicationSettingsOptions;
private readonly IOptions<ConnectionStrings> _connectionStringsOptions;
public MyFunctions(IOptions<ApplicationSettings> applicationSettingsOptions, IOptions<ConnectionStrings> connectionStringsOptions)
{
// the "Values" section of the configuration file
_applicationSettingsOptions = applicationSettingsOptions;
@aranm
aranm / Install PHP 5.3 on Ubuntu 14.04(trusty)
Created January 10, 2019 08:00 — forked from arbabnazar/Install PHP 5.3 on Ubuntu 14.04(trusty)
How to install PHP 5.3 on Ubuntu 14.04
#Add the Ubuntu 12.04(precise) repositories
cat <<EOF >> /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu precise main restricted universe
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
EOF
# Update the repos
apt-get update
= The Feed is King (or Queen)
When creating a social network type application the feed is king, the most common query that will be run against your service will be a request to get the feed. There are of course many ways to model the feed and a couple of components that are required.
To do a very simple feed one might structure the data as follows:
Users follow other users
[cypher]
----

How to create a GraphGist

You create a GraphGist by creating a GitHub Gist in AsciiDoc and enter the URL to it in the form on this page. Alternatively, you can put an AsciiDoc document in Dropbox and enter the public URL in the form.

This GraphGist shows the basics of using AsciiDoc syntax and a few additions for GraphGists. The additions are entered as comments on their own line. They are: //console for a query console; //hide, //setup and //output to configure a query; //graph and //table to visualize queries and show a result table.

Click on the Page Source button in the menu to see the source for this GraphGist.

var events = require('events');
function callSomething(){
var eventEmitter = new events.EventEmitter();
console.log("Method called");
eventEmitter.emit("data", "Hello immediately (you will never see this message)");
@aranm
aranm / Gradient-Bubbles-on-Canvas.markdown
Created September 27, 2013 05:38
A Pen by Aran Mulholland.