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 / 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 / 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 / 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
@jonchurch
jonchurch / index.html
Created June 29, 2017 18:35 — forked from ColeTownsend/index.html
The Micro Stripe demo front end.
<!DOCTYPE html>
<html>
<head>
<title>Micro Stripe Checkout</title>
<meta charSet='utf-8' />
<meta name='viewport' content='initial-scale=1.0, width=device-width' />
<script src="https://js.stripe.com/v3/"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<style>
* {
@jonchurch
jonchurch / asyncloops.js
Created July 22, 2017 18:41 — forked from lukehoban/asyncloops.js
Async/await and parallel loops
// ES6 w/ Promises
// Note: From a React starter template - see https://t.co/wkStq8y3I5
function fetchData(routes, params) {
let data = {};
return Promise.all(routes
.filter(route => route.handler.fetchData)
.map(route => {
return route.handler.fetchData(params).then(resp => {
data[route.name] = resp;
@jonchurch
jonchurch / todos.js
Last active July 24, 2017 17:44 — forked from julianburr/todos.js
Node script to list todos notes in code base
/**
* Author: Julian Burr <https://github.com/julianburr>
* License: https://creativecommons.org/publicdomain/zero/1.0/
*
* This script basically just runs through all source files and
* prints out a list of files and lines where it found the TODO
* keyword
*
* If you want to look for other keywords, just changed the
* searchRegEx to your needs :)
@jonchurch
jonchurch / gist:410f40becf7295445a375a7bf599f6b5
Last active September 6, 2017 07:30
Linux commands for disk space exploration
# list largest files in current dir by descending
du -ch -d 1 | sort -hr
# list files in a certain range
du -ch | grep '[0-5]G'
# common place to start
du -ch /home | grep '[0-9]G'
@jonchurch
jonchurch / printTodo.js
Created September 11, 2017 02:34
Print todos in dir
/**
* Author: Julian Burr <https://github.com/julianburr>
* License: https://creativecommons.org/publicdomain/zero/1.0/
*
* This script basically just runs through all source files and
* prints out a list of files and lines where it found the TODO
* keyword
*
* If you want to look for other keywords, just changed the
* searchRegEx to your needs :)