Skip to content

Instantly share code, notes, and snippets.

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

Sandrino Di Mattia sandrinodimattia

🏠
Working from home
View GitHub Profile
@sandrinodimattia
sandrinodimattia / gist:5a8dedee87059a687ccd
Created January 23, 2015 10:43
Go to strategy if only one is available
<!DOCTYPE html>
<html>
<head>
...
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src="//cdn.auth0.com/js/lock-6.10.min.js"></script>
<script>
...
@sandrinodimattia
sandrinodimattia / gist:555c8416606823bf8581
Created January 21, 2015 11:22
auth0-angular and usemin
{
"name": "TestEnv",
"version": "0.0.0",
"authors": [
"Tom Reunes <[email protected]>"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
<style type="text/css">
.something {
color: red;
font-weight: 600;
}
</style>
# Welcome to @@application.name@@!
Thank you for signing up. Please verify your email address by clicking the following link:
@sandrinodimattia
sandrinodimattia / gist:e28945a8779b5496e053
Created January 19, 2015 08:48
Passing login_hint in Auth0 lock
widget
.on('signin submit', function (options, context) {
if (!options.authParams)
options.authParams = {};
options.authParams.login_hint = context.email;
});
param
(
[string]$ServiceName,
[string]$VmName,
[string]$UserName,
[string]$Password
)
$ErrorActionPreference = "Stop"
@sandrinodimattia
sandrinodimattia / gist:7347313
Created November 7, 2013 01:20
ServiceManagement Authentication
public static class CertificateCloudCredentialsFactory
{
public static CertificateCloudCredentials FromPublishSettingsFile(string path, string subscriptionName)
{
var profile = XDocument.Load(path);
var subscriptionId = profile.Descendants("Subscription")
.First(element => element.Attribute("Name").Value == subscriptionName)
.Attribute("Id").Value;
var certificate = new X509Certificate2(
Convert.FromBase64String(profile.Descendants("PublishProfile").Descendants("Subscription").Single().Attribute("ManagementCertificate").Value));
public class WebRole : RoleEntryPoint
{
public override bool OnStart()
{
using (var serverManager = new ServerManager())
{
var applicationPoolName = serverManager
.Sites[RoleEnvironment.CurrentRoleInstance.Id + "_Web"].Applications["/"].ApplicationPoolName;
// Update application pool (0 = Terminate / 1 = Suspend).
@sandrinodimattia
sandrinodimattia / bookmarklet.js
Created July 17, 2013 22:47
Windows Azure Portal - Custom Javascript bookmarklet
$.post('/MonetaryCredit', function(data) {
var table = $('<table />')
.attr('style', 'border: 1px solid black; border-collapse: collapse; width: 100%')
.append($('<thead />').attr('style', 'font-weight: bold')
.append($('<td>Subscription</td><td>TotalCredit</td><td>Remaining Credit</td><td>Burn Rate</td><td>Might Run Out</td>')));
$.each(data, function(idx, sub) {
if (sub.MonetaryCreditInfo != null) {
table.append($('<tr />')
.attr('style', 'border: 1px solid black;')
function callwebsite() {
console.info("Executing job: callwebsite");
var req = require('request');
req.post({
headers: { 'Content-Type': 'application/json' },
url: "http://tempsdm.azurewebsites.net/scheduler/executetask",
body: JSON.stringify({ name: "cleanUpData" })
},
function(error, result, body) {
function warmup() {
warmUpSite("http://tempsdm.azurewebsites.net/");
warmUpSite("http://sandrino.azurewebsites.net/");
warmUpSite("http://myapp.cloudapp.net/");
}
function warmUpSite(url) {
console.info("warming up: " + url);
var req = require('request');