Skip to content

Instantly share code, notes, and snippets.

@marcantoine
marcantoine / showMetabaseQuestiontAsiOSWidget.js
Last active June 13, 2022 08:15
showMetabaseQuestiontAsiOSWidget.js
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// and @levelsio's https://gist.github.com/levelsio/a1ca0dd434b77ef26f6a7c403beff4d0
// HOW TO
// 1) Make a new Metabase Question
// 2) Make the result an unique number and choose Visualization > Number
// 3) Write your metabase domain, your email and password below
const domain = "https://metabase.endpoint.com"
const username = "my.e@mail.com"
const password = "p@ssw0rd"
@marcantoine
marcantoine / passport-telegram.js
Created June 26, 2018 16:17
sign in with telegram
// this is the file where i configure the telegram strategy for passport
const TelegramStrategy = require('passport-telegram-official') // i use this package
module.exports = function(passport){
passport.use( // i say to passport
new TelegramStrategy({ // hey please use the TelegramStrategy
botToken: process.env.BOT_TOKEN // with this bot (ps the token of the bot that i keep in an environment variable
},
async function(profile, done) { // then also do this stuff below to check if the user exist or to create it
//so i made a specific file for this bot cause i will want to add some other stuff in there
//its a bit useless for now and could totally be in the feedbackController file
// also please install telegraf : https://www.npmjs.com/package/telegraf
const Telegraf = require('telegraf')
// the bot token botfather give you when creating the bot.
// To create the bot, just talk to @botfather and type follow the instruction
//After setting the name and username you can access the token
const bot = new Telegraf(process.env.BOT_TOKEN)
bot.start((ctx) => ctx.reply('Welcome'))