Skip to content

Instantly share code, notes, and snippets.

View jonchurch's full-sized avatar
♥️

Jon Church jonchurch

♥️
View GitHub Profile
@jonchurch
jonchurch / README-Template.md
Created July 8, 2016 15:21 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisities

@jonchurch
jonchurch / gesture.js
Created October 4, 2016 19:18 — forked from eguneys/gesture.js
A Gesture Manager for Phaser.
'use strict';
define(['phaser'], function(Phaser) {
function Gesture(game) {
this.game = game;
this.swipeDispatched = false;
this.holdDispatched = false;
this.isTouching = false;
@jonchurch
jonchurch / verify_xhub_fb.js
Last active June 16, 2017 19:17
Express Middleware for Botkit -- Verify xhub signature of requests sent to webhook
var crypto = require('crypto');
var bodyParser = require('body-parser');
var debug = require('debug')('botkit:verify_xhub_fb');
module.exports = function(webserver, controller) {
if (controller.config.validate_requests === true) {
// Load verify middleware just for post route on our receive webhook, and catch any errors it might throw to prevent the request from being parsed further.
webserver.post('/facebook/receive', bodyParser.json({verify: verifyRequest}));
@jonchurch
jonchurch / beginner.vimrc.vim
Created February 24, 2017 00:54 — forked from pthrasher/beginner.vimrc.vim
A well commented beginner set of vim settings for your ~/.vimrc
" Beginners .vimrc
" v0.1 2012-10-22 Philip Thrasher
"
" Important things for beginners:
" * Start out small... Don't jam your vimrc full of things you're not ready to
" immediately use.
" * Read other people's vimrc's.
" * Use a plugin manager for christ's sake! (I highly recommend vundle)
" * Spend time configuring your editor... It's important. Its the tool you
" spend 8 hours a day crafting your reputation.
@jonchurch
jonchurch / glitch_vimify.js
Last active April 18, 2021 01:57
Vim Bindings for Glitch.com editor
// Load your Glitch project, paste this into the javascript console of chrome inspect
// Enjoy vim goodness!
(function () {
var makeCursorFat = function() {
var style = document.createElement('style');
style.textContent =
'div.CodeMirror div.CodeMirror-cursor { ' +
'width: auto; ' +
'border: 0; ' +
@jonchurch
jonchurch / prefs.js
Last active October 5, 2022 15:36
Dracula theme for Chrome Secure Shell, for all of us using crouton!
// Paste this whole file into your Chrome Secure Shell window's inspect console, and run it!
term_.prefs_.set('enable-bold', false)
term_.prefs_.set('background-color', "#282a36");
term_.prefs_.set('foreground-color', "#f8f8f2");
term_.prefs_.set('color-palette-overrides', [
"#000000",
"#ff5555",
"#50fa7b",
@jonchurch
jonchurch / chaining.js
Created March 15, 2017 01:15
Example of two ways to chain questions in botkit v0.5.1
module.exports = function(controller) {
// Chaining multiple questions together using callbacks
// You have to call convo.next() in each callback in order to keep the conversation flowing
controller.hears('qq', 'message_received', function(bot, message) {
bot.startConversation(message, function(err, convo) {
convo.say('Lets get to know each other a little bit!')
convo.ask('Which is more offensive? Book burning or flag burning?', function(res, convo) {
convo.next()
@jonchurch
jonchurch / chaining.js
Last active February 1, 2019 03:03
Example of two ways to chain questions in botkit v0.5.1
// drop this file into your skills folder if using a botkit-starter kit
// or just copy paste whats inside this function into your bot script
module.exports = function(controller) {
// Chaining multiple questions together using callbacks
// You have to call convo.next() in each callback in order to keep the conversation flowing
controller.hears('qq', 'message_received', function(bot, message) {
bot.startConversation(message, function(err, convo) {
convo.say('Lets get to know each other a little bit!')
@jonchurch
jonchurch / lex-response.js
Last active September 27, 2018 10:09
Valid ElicitSlot AWS Lex Lambda response
'use strict';
exports.handler = (event, context, callback) => {
// Currently all possible fields
// {
// "sessionAttributes": {
// "key1": "value1",
// "key2": "value2"
// ...
// },
@jonchurch
jonchurch / bot.js
Last active June 16, 2017 21:52
Use custom express webserver with Botkit
var Botkit = require('botkit');
// Create the Botkit controller, which controls all instances of the bot.
var controller = Botkit.facebookbot({
debug: true,
verify_token: process.env.verify_token,
access_token: process.env.page_token,
});
// Set up an Express-powered webserver to expose oauth and webhook endpoints
// We are passing the controller object into our express server module