Skip to content

Instantly share code, notes, and snippets.

View stevehobbsdev's full-sized avatar
🌋

Steve Hobbs stevehobbsdev

🌋
View GitHub Profile
@stevehobbsdev
stevehobbsdev / app.js
Last active August 29, 2015 14:25
Promisifying Azure Table Storage queries in Node
/**
* ATS Promisfy node demo
* Steve Hobbs, July 2015
* See associated package.json for package install
*/
var chalk = require('chalk');
var azure = require('azure-storage');
var deferred = require('deferred');
IEnumerable<T> GetEnumOrder<T>()
{
var type = typeof(T);
var tmp = new List<dynamic>();
foreach (var value in Enum.GetValues(type))
{
var attr = type.GetMember(value.ToString())[0].GetCustomAttribute(typeof(DisplayAttribute), false) as DisplayAttribute;
tmp.Add(new
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Filters
{
using System;
using System.Web.Mvc;
using System.Web.Routing;
namespace Models
{
public class RedirectToActionAnchor : RedirectToRouteResult
{
/// <summary>
/// Gets or sets the action.
@stevehobbsdev
stevehobbsdev / index.js
Created May 26, 2017 09:44
Example Json Web Token generator in NodeJS
const crypto = require('crypto')
const base64url = require('base64-url')
const encode = input => base64url.encode(input)
const header = JSON.stringify({
alg: "HS256",
"typ": "JWT"
})
const payload = JSON.stringify({
@stevehobbsdev
stevehobbsdev / login_logout_cdn
Created April 27, 2021 09:37
A login/logout example using SPA SDK from the CDN. Put this content into an HTML file and serve on localhost:3000.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Test</title>
</head>
<body>
<button id="login">Log in</button>
@stevehobbsdev
stevehobbsdev / auth0-spa-js-orgs.html
Last active August 4, 2021 13:19
Auth0 SPA SDK + Organizations + loginWithRedirect
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Organizations Example</title>
</head>
<body>
<div>
<form id="init-form">
@stevehobbsdev
stevehobbsdev / main.dart
Last active March 14, 2022 13:35
Dart: fluent 1
void main() {
final url = Auth0
.webAuth('elkdanger.eu.auth0.com', '123')
.audience('test')
.buildUrl();
print(url);
}
class WebAuth {
@stevehobbsdev
stevehobbsdev / main.dart
Created March 14, 2022 13:38
Dart: Fluent 2
void main() {
final auth0 = Auth0('elkdanger.eu.auth0.com', 'test');
// Must wrap cascade in brackets to get return result
// of `start`
final result = (WebAuth(auth0)
..audience = 'test'
..orgId = 'test')
.start();
@stevehobbsdev
stevehobbsdev / main.dart
Created March 15, 2022 11:49
Dart: Api 3
// SPA JS-like
// Tries to implement pattern like: https://dart.academy/creational-design-patterns-for-dart-and-flutter-builder/
void main() {
final client = Auth0WebClient(
domain: 'test', clientId: 'test', audience: 'test', issuer: 'test');
client.loginWithRedirect();
}