Skip to content

Instantly share code, notes, and snippets.

View xinmyname's full-sized avatar

Andy Sherwood xinmyname

View GitHub Profile
using (var serviceRequest = new WebClient())
{
string token = GetAuthorizationToken("yourservice","owner", "NW1wr7/nlgggTFnB5L7nDBrOLC+o1E1P4ZZqPaP2mY4=");
serviceRequest.Headers["Authorization"] = string.Format("WRAP access_token=\"{0}\"", token);
string response = serviceRequest.DownloadString(new Uri(url));
return response;
}
// connects to ACS and gets WRAP Authorization token
@ryanflorence
ryanflorence / angular.js
Last active October 30, 2019 01:42
Comparing an avatar implementation with angular and ember. http://www.angularails.com/articles/creating_simple_directive_in_angular
// Because people can't seem to find the gist description, here is the source
// of this code, a post found in last weeks JS Weekly, it is not my code
// http://www.angularails.com/articles/creating_simple_directive_in_angular
angular.module('ui-multi-gravatar', [])
.directive('multiAvatar', ['md5', function (md5) {
return {
restrict: 'E',
link:function(scope, element, attrs) {
@aidancasey
aidancasey / gist:5222756
Last active December 15, 2015 07:19
Securing and authenticating azure service bus relay messages using a shared secret. : http://acaseyblog.wordpress.com/2013/03/22/securing-and-authenticating-azure-service-bus-relay-messages-using-a-shared-secret/
using (var serviceRequest = new WebClient())
{
string token = GetAuthorizationToken("yourservice","owner", "NW1wr7/nlgggTFnB5L7nDBrOLC+o1E1P4ZZqPaP2mY4=");
serviceRequest.Headers["Authorization"] = string.Format("WRAP access_token=\"{0}\"", token);
string response = serviceRequest.DownloadString(new Uri(url));
return response;
}
// connects to ACS and gets WRAP Authorization token
@davidfowl
davidfowl / Examples
Created May 21, 2011 08:19
Powershell function that recursively walks all project items within a project and lets you execute an action on each one
# Print all project items
Recurse-Project -Action {param($item) "`"$($item.ProjectItem.Name)`" is a $($item.Type)" }
# Function to format all documents based on https://gist.github.com/984353
function Format-Document {
param(
[parameter(ValueFromPipelineByPropertyName = $true)]
[string[]]$ProjectName
)
Process {