Skip to content

Instantly share code, notes, and snippets.

View MichaelBarney's full-sized avatar
🤖

Michael Barney MichaelBarney

🤖
View GitHub Profile
@MichaelBarney
MichaelBarney / SwiftUI_Ad_Banner.swift
Last active March 15, 2022 03:45
A google AdMob Banner implementation in SwiftUI
import SwiftUI
import GoogleMobileAds
import UIKit
final private class BannerVC: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
let view = GADBannerView(adSize: kGADAdSizeBanner)
let viewController = UIViewController()
@MichaelBarney
MichaelBarney / SwiftUI_Ad_Interstitial.swift
Created October 22, 2019 12:15
A google AdMob Interstitial implementation in SwiftUI
import SwiftUI
import GoogleMobileAds
import UIKit
final class Interstitial:NSObject, GADInterstitialDelegate{
var interstitial:GADInterstitial = GADInterstitial(adUnitID: interstitialID)
override init() {
super.init()
LoadInterstitial()
@MichaelBarney
MichaelBarney / SwiftUI_Ad_Rewarded.swift
Created October 22, 2019 12:28
A google AdMob Reward implementation in SwiftUI
import SwiftUI
import GoogleMobileAds
import UIKit
final class Rewarded: NSObject, GADRewardedAdDelegate{
var rewardedAd:GADRewardedAd = GADRewardedAd(adUnitID: rewardID)
var rewardFunction: (() -> Void)? = nil
@MichaelBarney
MichaelBarney / botkitMessengerSimpleConfig.js
Last active May 1, 2020 19:45
A simple implementation of a Botkit configuration for Facebook Messenger
// Import Botkit
const { Botkit } = require('botkit');
// Import Facebook Adapter
const { FacebookAdapter, FacebookEventTypeMiddleware } = require('botbuilder-adapter-facebook');
// Load process.env values from .env file
require('dotenv').config();
// Configure Facebook Adapter
module.exports = function(controller) {
controller.hears(['Oi', 'Olá!'],'message', async(bot, message) => {
await bot.reply(message, 'Olá!');
});
}
module.exports = function(controller) {
controller.hears(new RegExp(/^meu nome é (.*?)$/i), 'message', async(bot, message) => {
let param = message.matches[1];
await bot.reply(message, `Bem-vindo ${ param }!`);
});
}
controller.hears('get_started', 'facebook_postback', async(bot, message) => {
await bot.reply(message, `Vamos começar!`);
await bot.reply(message, `Qual é o seu nome?`);
});
controller.on('facebook_postback', async(bot, message) => {
await bot.reply(message,`Escutei o seguinte postback: ${ message.text }`);
});
controller.hears('get_started', 'facebook_postback', async(bot, message) => {
await bot.reply(message, `Vamos começar!`);
await bot.reply(message, {
text: 'Qual é o seu nome?',
quick_replies: [
{
title: "Michael",
payload: "meu nome é Michael",
},
{
module.exports = function(controller) {
// Mensagens
controller.hears(['Oi', 'Olá!'],'message', async(bot, message) => {
await bot.reply(message, 'Olá!');
});
controller.hears(new RegExp(/^meu nome é (.*?)$/i), 'message', async(bot, message) => {
let param = message.matches[1];
await bot.reply(message, `Bem-vindo ${ param }!`);
});