Skip to content

Instantly share code, notes, and snippets.

View tjanczuk's full-sized avatar

Tomasz Janczuk tjanczuk

View GitHub Profile
@tjanczuk
tjanczuk / hello-auth.js
Created May 6, 2016 22:02
Authenticated Webtask
var app = new (require('express'))();
var ejs = require('ejs');
var wt = require('webtask-tools');
Function.prototype.stringify = function () {
var match = this.toString().match(/[^]*\/\*([^]*)\*\/\s*\}$/);
return match ? match[1] : '';
};
app.get('/', function (req, res) {
@tjanczuk
tjanczuk / ldap.js
Last active February 3, 2016 19:51
"use latest";
module.exports = (ctx, req, res) => {
const end = (statusCode, data) => {
res.writeHead(statusCode, { 'Content-Type': 'application/json' });
res.end(JSON.stringify(data, null, 2));
};
if (!ctx.data.connection) {
return end(500, { message: 'The Auth0 AD/LDAP Connection is missing.' });
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
<style>
/*
@-webkit-viewport { width: device-width; }
@-moz-viewport { width: device-width; }
@-ms-viewport { width: device-width; }
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height">
<style>
body {
background: blue;
}
#content {
@tjanczuk
tjanczuk / RxEdge
Created November 22, 2013 23:27
Connecting to Rx Observable in Node.js with Rx Observer in .NET within one process using Edge.js.
var edge = require('edge'); // http://tjanczuk.github.io/edge
var Rx = require('rx'); // https://github.com/Reactive-Extensions/RxJS
var createSubject = edge.func({
source: function () {/*
using System.Reactive.Linq;
using System.Reactive.Subjects;
async (dynamic input) => {
var s = new Subject<object>();
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type='text/javascript' src='/js/lib/dummy.js'></script>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>Mobile Chapters Map</name>
<description><![CDATA[ <a href="http://mobilechapters.com"><img src="http://mobilechapters.com/images/logo_small.png"/></a> ]]></description>
<Placemark>
<name>Jungfrau, Switzerland</name>
<description>This is a description</description>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>Mobile Chapters Map</name>
<description><![CDATA[ <h2>Mobile Chapters Map</h2><br><a href="http://mobilechapters.com">http://mobilechapters.com</a>]]></description>
<Placemark>
<name>Jungfrau, Switzerland</name>
<Point>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>Mobile Chapters Map</name>
<description><![CDATA[ <a href="http://mobilechapters.com"><img src="http://mobilechapters.com/images/logo_small.png"/></a> ]]></description>
<Placemark>
<name>Jungfrau, Switzerland</name>
<Point>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<name>Mobile Chapters Map</name>
<description><![CDATA[ <a href="http://mobilechapters.com"><img src="http://mobilechapters.com/logo_small.png"/></a> ]]></description>
<Placemark>
<name>Jungfrau, Switzerland</name>
<Point>