Skip to content

Instantly share code, notes, and snippets.

View thameera's full-sized avatar

Thameera Senanayaka thameera

View GitHub Profile
@thameera
thameera / server
Created January 6, 2014 15:26
Start a simple server in the current directory
#!/bin/bash
# USAGE
# server [optional port]
PORT=${1:-9000}
python -m SimpleHTTPServer $PORT
@thameera
thameera / auth0-webtask.js
Last active January 4, 2016 18:12
A webtask ( https://webtask.io/ ) that takes in the text of a tweet and adds the URL in that tweet to Pocket queue if there's any. eg: This can called from an IFTTT task that triggers each time when a tweet mentioning the word 'auth0' is found.
"use latest";
/*
* This webtask takes in the text of a tweet that mentions the
* word 'auth0' and if there's a link in that tweet adds it to
* the Pocket queue.
* Pocket consumer key and access token should be set as secrets
* to the webtask.
*/
@thameera
thameera / app.js
Created January 15, 2016 12:58
winston singleton
'use strict';
const logger = require('./logger');
const util = require('./util');
util.doStuff();
{% if request_language contains ",nl;" %}
Uw verificatie code: {{ code }}
{% elsif request_language contains ",es;" %}
Tu código de verificación es: {{ code }}
{% else %}
Your verification code is: {{ code }}
{% endif %}
@thameera
thameera / create_and_link_users.js
Last active June 10, 2016 10:52
Auth0 - Create new passwordless user and link him to current account on first login
hKRib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgIyENN+isSjR76vaB0iTfP4njkg2RfuzO1RbrGQngn/sKp3BheWxvYWTFAux7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTIwMjMyMTBkMzdlOGFjNGEzNDdiZWFmNjgxZDIyNGRmM2Y4OWUzOTIwZDkxN2VlY2NlZDUxNmViMTkwOWUwOWZmYjBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwMjMyMTBkMzdlOGFjNGEzNDdiZWFmNjgxZDIyNGRmM2Y4OWUzOTIwZDkxN2VlY2NlZDUxNmViMTkwOWUwOWZmYjBhIiwidWlkIjoiNjczODQ5NjJlMTAxYzY0Mjc2MGJkODVkNjRkN2I2MTkiLCJ1c2VybmFtZSI6InRoYW1lZXJhIn0sInNlcnZpY2UiOnsibmFtZSI6ImdpdGh1YiIsInVzZXJuYW1lIjoidGhhbWVlcmEifSwidHlwZSI6IndlYl9zZXJ2aWNlX2JpbmRpbmciLCJ2ZXJzaW9uIjoxfSwiY2xpZW50Ijp7Im5hbWUiOiJrZXliYXNlLmlvIGdvIGNsaWVudCIsInZlcnNpb24iOiIxLjAuMTYifSwiY3RpbWUiOjE0Njc5MjgzODIsImV4cGlyZV9pbiI6NTA0NTc2MDAwLCJtZXJrbGVfcm9vdCI6eyJjdGltZSI6MTQ2NzkyODMyOSwiaGFzaCI6IjNkM2RmMTBjNGE3YzYxMzUwZDYxMDI2ZTFjMTE0MzQxODMyZTgzZWY1ZmFhNjkzMTExNDU0MzA5NzExMjFmNmE2YzBjNTE4ZTFiODIxMTA2ZDE2MWRkY2E0N2FjNDc4YzI1Y2YyMzU1YjYwZjkxOTZmZDRiZTJlOTI4OTk2NWM3Iiwic2Vxbm8iOjUxMjk1NH0sInByZXYiOiI1YjM0ZjJkZTg2MDliN2I1ZWIwNzFkMTNlMDYwNWVkOTdi
@thameera
thameera / template.html
Created July 25, 2016 09:23
Auth0 login page with Lock v10
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
html, body { padding: 0; margin: 0; }
@thameera
thameera / Zendesk-Slack-post.md
Last active August 31, 2016 11:12
Mention Slack users in Zendesk using Webtasks

Whenever you get a cool idea to create an app, the mere thought of preparing and maintaining a server always gets you down. Not to mention all the security considerations you have to think through. The advent of PaaS services like Heroku solved this to some extent. Now that serverless technologies have come into the mainstream, bringing your ideas into reality is easier than ever.

Serverless platforms allows you to focus more on the code and get real work done without worrying about managing servers. Many people prefer the term FaaS (Function-as-a-Service) to serverless, because what essentially functions are the unit of application logic in this realm. Auth0's Webtask is a hassle-free serverless platform to deploy and run your functions.

At Auth0, we tend to solve most of our problems using Webtasks. Here's an example of how we used them to create a Slack bot to tackle a pressing need we had.

The Problem

Not to brag, but Auth0 is known for its wonderful customer service. We use

@thameera
thameera / change-secret.md
Last active September 3, 2016 05:26
How to change Auth0 global client secret

You can revoke the global client secret yourself as follows:

  1. Go to your Account Settings -> Advanced tab and copy the Global Client ID value.
  2. Go to the Management API v2 Explorer
  3. Click on Clients -> Update a client in the left sidebar.
  4. In the center panel, select the scopes update:clients and update:client_keys.
  5. In the id textbox, paste the global client ID that you copied in step 1.
  6. Enter the new global client secret in the body textarea, like this:
@thameera
thameera / linkedin.html
Created May 30, 2017 03:21
Auth0.js 7.6 popup mode - linkedin
<!DOCTYPE html>
<html>
<body>
<script src="//cdn.auth0.com/w2/auth0-7.6.1.min.js"></script>
<button type="button" onclick="login()">Log in</button>
<script type="text/javascript">