Skip to content

Instantly share code, notes, and snippets.

using AcsOAuth2;
namespace ConsoleApplication1
{
internal class Program
{
private static void Main(string[] args) {
var client = new ManagementService("SERVICE_NAMESPACE", "SERVICE_USERNAME", "SERVICE_USERKEY");
client.UpdateIdentityRedirectAddress("Google", "http://myapp/");
}
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using AcsOAuth2;
namespace MyApp
{
public class MvcApplication : System.Web.HttpApplication
public string CreateAuthorizationCode() {
var service = new ManagementService("SERVICE_NAMESPACE", "SERVICE_USERNAME", "SERVICE_USERKEY");
var delegation = service.CreateOAuth2Delegation("SERVICE_IDENTITY_NAME", "RELYING_PARTY_NAME", "USERNAME", "IDENTITY_PROVIDER");
return delegation.AuthorizationCode;
}
public void Ping(string authorizationCode) {
var client = new WebClient { BaseAddress = string.Format("ACS_URL") };
var values = new NameValueCollection
{
{"code", authorizationCode},
{"grant_type", "authorization_code"},
{"redirect_uri", "REDIRECT_URI"},
{"client_id", "SERVICE_USERNAME"},
{"client_secret", "SERVICE_USERKEY"},
@joaomoreno
joaomoreno / Startup.cs
Created February 23, 2015 14:03
ASP .NET vNext WebApplication
using Microsoft.AspNet.Builder;
namespace KWebStartup
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseWelcomePage();
@joaomoreno
joaomoreno / listc.py
Created November 22, 2010 13:14
list comprehensions environment mess
>>> a = 1
>>> print a
1
>>> [a for a in range(10)]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> print a
9
@joaomoreno
joaomoreno / mass_like.js
Created April 4, 2011 23:29
Click all Like buttons in Facebook page
$('.like_link').filter(function(e){return $(this).attr('name') == 'like';}).each(function(i){$(this).click()});
@joaomoreno
joaomoreno / gist:1038899
Created June 21, 2011 21:03
[vim] Coffeescript syntax inside textile files
syn include @Coffee syntax/coffee.vim
syn region coffeeCode matchgroup=Snip start="{% highlight coffeescript %}" end="{% endhighlight %}" contains=@Coffee
@joaomoreno
joaomoreno / index.html
Created April 22, 2013 13:49
Firebug caching issue
<html>
<body>
<div id="result"></div>
<script>
var div = document.getElementById('result');
var req = new XMLHttpRequest();
req.onload = function () {
var req2 = new XMLHttpRequest();
req2.onload = function () {
@joaomoreno
joaomoreno / gist:960b4f643b2ff09bcdf7
Created January 6, 2016 09:16
VSCode Stack Overflow
Please ask 'how-to' questions about VS Code on [Stack Overflow](https://stackoverflow.com/questions/tagged/vscode) using
the tag `vscode`.
The VS Code development team together with the VS Code Community will answer question your question over there.
Here is how the development team tracks feedback on the different channels: [Feedback Channels](https://github.com/Microsoft/vscode/wiki/Feedback-Channels).