Skip to content

Instantly share code, notes, and snippets.

View ntotten's full-sized avatar

Nathan Totten ntotten

View GitHub Profile
@ntotten
ntotten / AccountController.FacebookCallback1.cs
Last active April 10, 2020 03:18
Facebook Authentication with the Facebook C# SDK and ASP.NET MVC 4
public ActionResult FacebookCallback(string code)
{
var fb = new FacebookClient();
dynamic result = fb.Post("oauth/access_token", new
{
client_id = "your_app_id_here",
client_secret = "your_app_secret_here",
redirect_uri = RedirectUri.AbsoluteUri,
code = code
});
@ntotten
ntotten / HomeController.cs
Last active October 27, 2019 16:13
IP Address Filter for Windows Azure Web Sites
[IPFilter("192.168.0.0/24")]
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<lightning:card title="Walk Score" iconName="custom:custom5">
<div style="padding: 0; margin: 0; border: 0; outline: 0; position: relative; width: 100%; padding-bottom: 30%">
<div style="padding: 0; margin: 0; border: 0; outline: 0; position: absolute; top: 0; bottom: 0; left: 0; right: 0;">
<img src="//pp.walk.sc/badge/walk/1099-Stewart-St-Seattle-98101.svg"
style="border-radius: 0; box-shadow: none; outline: 0; color: transparent; margin: 0 0 0 2.000000%; float: left; padding: 0; width: 30.666667%; background: none; border: 0;"
alt="Walk Score of 1099 Stewart Street Seattle WA 98101" />
<img src="//pp.walk.sc/badge/transit/1099-Stewart-St-Seattle-98101.svg"
style="border-radius: 0; box-shadow: none; outline: 0; color: transparent; margin: 0 0 0 2.000000%; float: left; padding: 0; width: 30.666667%; background: none; border: 0;"
alt="Transit Score of 1099 Stewar
@ntotten
ntotten / apex.js
Created March 9, 2018 18:53
Monaco language definition for apex. Still needs inline SOQL.
// Language definition for Apex
return {
// Set defaultToken to invalid to see what you do not tokenize yet
// defaultToken: 'invalid',
keywords: [
'abstract', 'continue', 'for', 'new', 'switch', 'assert', 'default',
'goto', 'package', 'synchronized', 'boolean', 'do', 'if', 'private',
'this', 'break', 'double', 'implements', 'protected', 'throw', 'byte',
'else', 'import', 'public', 'throws', 'case', 'enum', 'instanceof', 'return',
'transient', 'catch', 'extends', 'int', 'short', 'try', 'char', 'final',
993898: QUIC_SESSION
r6---sn-jvh2vgp0h-jaul.googlevideo.com
Start Time: 2017-10-05 10:48:25.236
t=247821 [st= 0] +QUIC_SESSION [dt=12388]
--> cert_verify_flags = 6
--> host = "r6---sn-jvh2vgp0h-jaul.googlevideo.com"
--> port = 443
--> privacy_mode = true
--> require_confirmation = false
@ntotten
ntotten / AccountController.cs
Created March 21, 2011 18:31
ASP.NET MVC 3 Simple Authorization
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Facebook;
using MyFacebookSite3434.Models;
using System.Web.Security;
namespace MyFacebookSite3434.Controllers
@ntotten
ntotten / authorization.sh
Created July 29, 2017 16:41
Let's Encrypt Certbot Authorization Hook for DNSimple
#!/bin/bash
(
ACCESS_TOKEN="YOUR_ACCESS_TOKEN_HERE" # See https://developer.dnsimple.com/v2/oauth/
ACCOUNT_ID="YOUR_ACCOUNT_ID"
DOMAIN="YOUR_DOMAIN"
RECORD_ID="YOUR_RECORD_ID"
if [[ ! $(type -P curl) ]] ; then
@ntotten
ntotten / README.md
Last active April 6, 2017 18:32
Change Password Webtask

Change Password Webtask

In order to use this Auth0 WebTask you simply need to follow these instructions.

You first need to create an Auth0 Client and authorize this client to call the management API;

  1. Create a new Auth0 Client called "Change Password Service"
  2. Select the type of the client to be "Non-Interactive"
  3. On the "quickstart" screen that is show select "Auth0 Management API" in the drop down. This will show a orange box that says "This client is not authorized for this API."
  4. Click the button that says to "Navigate to the API and Authorize"
  5. Toggle the "Change Password Service" to authorized.
class ViewController: UIViewController {
@IBOutlet weak var oldPassword: UITextField!
@IBOutlet weak var newPassword: UITextField!
@IBOutlet weak var confirmPassword: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}