Skip to content

Instantly share code, notes, and snippets.

@ispiropoulos
ispiropoulos / Readme.md
Last active September 14, 2023 12:29 — forked from mikkipastel/index.js
facebook chatbot from cloud function in firebase

Firebase Cloud function for simple Messenger greet and echo Bot

Notes

You need to add 3 environment variables:

ACCESS_TOKEN

This is the page specific access token you have generated, from the app settings on the Facebook developers console

VERIFY_TOKEN

This is the verify token you will provide when you subscribe the app to the webhook on the Facebook developers console

@ispiropoulos
ispiropoulos / shelly.py
Created August 28, 2018 09:16
Shelly Switch Home Assistant Component
"""
Support for The Shelly Wifi switch.
Save this file inside ".homeassistant/custom_components/switch" (create the folders if not present) and restart HASS.
usage example:
switch:
- platform: shelly
switches:
@ispiropoulos
ispiropoulos / JSBlockTimer.swift
Created December 14, 2016 10:07
Swift Timer with Block
//
// JSBlockTimer.swift
//
//
// Created by John Spiropoulos on 14/12/2016.
// Copyright © 2016 John Spiropoulos. All rights reserved.
//
/*
Usage:
duration: How long do you want the timer to be active? (in seconds)
@ispiropoulos
ispiropoulos / JSDatePicker.swift
Last active November 23, 2016 12:44
UITextField with Date picker
//
// JSDateField.swift
//
//
// Created by John Spiropoulos on 21/11/2016.
// Copyright © 2016 Programize. All rights reserved.
//
import UIKit
@ispiropoulos
ispiropoulos / Date+Age.swift
Last active September 29, 2016 10:17
Get age from (Birth) Date object
//
// Date+Age.swift
//
//
// Created by John Spiropoulos on 29/09/16.
// Copyright © 2016 John Spiropoulos. All rights reserved.
//
/*
Swift 3 Helper extension:
@ispiropoulos
ispiropoulos / UserDefaults+CLLocation.swift
Last active July 17, 2021 00:29
Store CLLocation into UserDefaults
//
// UserDefaults+CLLocation.swift
//
//
// Created by John Spiropoulos on 28/09/16.
// Copyright © 2016 John Spiropoulos. All rights reserved.
//
/*
Swift 3 Helper extension:
@ispiropoulos
ispiropoulos / 0_reuse_code.js
Created February 3, 2016 10:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ispiropoulos
ispiropoulos / gist:b6a0eee7813b1e512a6d
Created January 26, 2015 15:55
Switch indexPath.section & indexPath.row using tuple
let indexPosition = (indexPath.section, indexPath.row)
switch indexPosition {
case (0, 0):
cell.textLabel?.text = "Section 0 - Row 0"
case (0, 1):
cell.textLabel?.text = "Section 0 - Row 1"
case (0, 2):
cell.textLabel?.text = "Section 0 - Row 2"
case (1, 0):