Skip to content

Instantly share code, notes, and snippets.

View thameera's full-sized avatar

Thameera Senanayaka thameera

View GitHub Profile
@thameera
thameera / json.js
Created May 26, 2014 04:05
Simple JSON parse/stringify
var JSON = {
// implement JSON.stringify serialization
stringify : function(obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
// simple data type
if (t == "string")
obj = '"' + obj + '"';
@thameera
thameera / cvimrc
Last active August 29, 2015 14:03
vimrc for cvim
let blacklists = ["https://mail.google.com/*", "https://inbox.google.com/*", "https://trello.com/*", "http://www.codewars.com/*", "http://typing.lk/"]
set nosmoothscroll
@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 / surfingkeys.txt
Last active March 22, 2023 21:59
SurfingKeys config
// an example to create a new mapping `ctrl-y`
mapkey('<Ctrl-y>', 'Show me the money', function() {
Normal.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).');
});
// Map disabling surfing keys hotkey
map('<Ctrl-i>', '<Alt-s>');
// Free up Alt-s for jetzt's use
unmap('<Alt-s>');
@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