Skip to content

Instantly share code, notes, and snippets.

View isaacrlevin's full-sized avatar

Isaac Levin isaacrlevin

View GitHub Profile
@isaacrlevin
isaacrlevin / Submit.cs
Last active November 21, 2018 19:56
Azure Function Contact Form
public static class Submit
{
[FunctionName("Submit")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
// Getting Form Data items from Request
var from = req.Form["fromEmail"].ToString();
var fromName = req.Form["fromName"].ToString();
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class JWTInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (req.method === 'DELETE' || req.method === 'POST' || req.method === 'PUT') {
let currentUser = JSON.parse(localStorage.getItem('currentUser'));
@isaacrlevin
isaacrlevin / RedditPoller.cs
Created August 3, 2017 21:50
Polling with Reddit
public static class RedditPoller
{
[FunctionName("TimerTriggerCSharp")]
public static void Run([TimerTrigger("0 */1 * * * *")]TimerInfo myTimer, TraceWriter log)
{
string url = "https://www.reddit.com/r/azure/new/.json";
List<Child> children = new List<Child>();
WebClient client = new WebClient();