Skip to content

Instantly share code, notes, and snippets.

View johnwheeler's full-sized avatar
🏠
Working from home

John Wheeler johnwheeler

🏠
Working from home
  • San Diego, California
View GitHub Profile
import { Button, Flex } from '@chakra-ui/react'
import { createMachine, guard, invoke, reduce, state, transition } from 'robot3'
import { useEffect, useState } from 'react'
import { createUseMachine } from 'robot-hooks'
const useMachine = createUseMachine(useEffect, useState)
// @formatter:off
const mergeIncoming = reduce((c, e) => ({ ...c, ...e.value }))
#!/usr/bin/env python
"""
pip install tiktoken requests
export OPENAI_API_KEY=<redact>
chmod +x prepare-commit-msg
mv prepare-commit-msg .git/hooks/
"""
import math
@johnwheeler
johnwheeler / memory_game.py
Created August 24, 2016 22:38
memory_game.py
import logging
from random import randint
from flask import Flask, render_template
from flask_ask import Ask, statement, question, session
app = Flask(__name__)
ask = Ask(app, "/")
logging.getLogger("flask_ask").setLevel(logging.DEBUG)
CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" UWSGI_PROFILE_OVERRIDE=ssl=true pip install uwsgi -Iv
import os
import yaml
import inspect
from functools import wraps, partial
from xml.etree import ElementTree
import aniso8601
from werkzeug.local import LocalProxy
from jinja2 import BaseLoader, ChoiceLoader, TemplateNotFound
from flask import current_app, json, request as flask_request, _app_ctx_stack
import os
import base64
import posixpath
from datetime import datetime
from six.moves.urllib.parse import urlparse
from six.moves.urllib.request import urlopen
from . import logger

Flask-Ask Live Presentation Over the Web

The creator of Flask-Ask will show your group of 3 or more how easy it is to program the Amazon Echo with Python!

You ask 'Alexa' to play songs, get the weather, and report scores. Those 'skills', as they're called, have an open API for building conversational apps. That API is the Alexa Skills Kit, and Flask-Ask is a Python framework that makes working with it easy.

Developing with Flask-Ask is fun. It's a novel experience to write and test conversational code,

@johnwheeler
johnwheeler / distance to point
Created December 28, 2015 17:37
distance to point
func distanceToPoint(point p: CGPoint, fromLineSegmentBetween l1: CGPoint, and l2: CGPoint) -> Float {
let a = p.x - l1.x
let b = p.y - l1.y
let c = l2.x - l1.x
let d = l2.y - l1.y
let dot = a * c + b * d
let lenSq = c * c + d * d
let param = dot / lenSq
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.network "private_network", ip: "192.168.0.100"
config.vm.provider "virtualbox" do |vb|
vb.memory = "8192"
end
var SRC_JS = 'client/js/**/*.js';
var SRC_LESS = 'client/less/**/styles.less';
var SRC_HTML = '*.html';
var DEST_STYLES = 'static/styles/';
var DEST_SCRIPTS = 'static/scripts/';
var PROXY = 'localhost:8000';
var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');