Skip to content

Instantly share code, notes, and snippets.

View bkeating's full-sized avatar
🤙
Gettin’ SUM & CALCin’ out

Benjamin Keating bkeating

🤙
Gettin’ SUM & CALCin’ out
View GitHub Profile
import moment from 'moment';
/**
* A business needs to know the hours in which it operates.
*
* Import `getBusinessHours` and get access to:
* - isCurrentlyOPen() - bool on wether or not the cafe is currently open
* - todaysWeekInt() - todays week number. Zero-based (Sunday=0)
* - getDayMeta(int) - returns the given days business hour meta as an object
*
@bkeating
bkeating / graphiql-dark-mode.css
Last active April 25, 2023 13:31
GraphiQL One Dark Alt (Dark Mode) theme by Ben Keating
<style>
/* GraphiQL One Dark Alt (Dark Mode) theme by Ben Keating[1]
* Colors taken from Atom's One Dark theme[2]. Add this file to the end of
* your <head> block[3] to override built-in default styling.
*
* [1]. https://twitter.com/flowpoke
* [2]. https://github.com/atom/atom/tree/master/packages/one-dark-ui
* [3]. e.g. `.../site-packages/graphene_django/templates/graphene/graphiql.html`
*/
@bkeating
bkeating / cafedb.js
Last active September 28, 2018 16:11
A cafe menu in the form of a js object
module.exports = {
category: [
{ id: 1, title: 'Breakfast', slug: 'breakfast', description: 'Changes Regularly - Febuary 1, 2016', },
{ id: 2, title: 'Lunch', slug: 'lunch', description: 'Changes Regularly - Febuary 1, 2016', },
{ id: 3, title: 'Evening', slug: 'evening', description: 'from 4pm - 8pm Tues. - Sat.', },
{ id: 4, title: 'Wine, Beer, Cocktails', },
{ id: 5, title: 'Sparkling', },
{ id: 6, title: 'Rose', },
{ id: 7, title: 'White', },
{ id: 8, title: 'Red', },
@bkeating
bkeating / index.html
Created September 6, 2018 17:25
React + JSX + LESSCSS in a single HTML file. No precompiling or bundler necessary. A poor man's JSBin.
<!DOCTYPE html>
<html lang="en">
<head>
<title>React + JSX + LESSCSS</title>
<!-- LESS style must come before the actual loading of less.js -->
<style type="text/less">
.container {
width: 90%;
@bkeating
bkeating / index.html
Last active September 6, 2018 17:23
React + JSX + LESSCSS in a single HTML file. No precompiling or bundler necessary.
<!DOCTYPE html>
<html lang="en">
<head>
<title>React + JSX + LESSCSS</title>
<!-- LESS style must come before the actual loading of less.js -->
<style type="text/less">
.container {
width: 90%;
// How do I go from this...
"{u'type': u'object', u'properties': {u'first_floor': u'open'}}"
// to a json object...
{"type": "object", "properties": { "first_floor": "open" }}

Raspberry Pi Kiosk

Instructions to go from zero to a Raspberry Pi Kiosk displaying a webpage with auto-refresh.

  • OS: Raspbian (Debian Wheezy) 2015-02-16
  • Browser: IceWeasel

Copy Raspbian to a SD Card (on OSX)

Instructions for other OSes.

@bkeating
bkeating / app.py
Created December 13, 2015 18:12
SysAPI - A Simple Example using bottle.py
from bottle import route, run, template, redirect
import socket
import subprocess
@route('/hello/<name>')
def index(name):
print(subprocess.call(["du", "-sh"]))
return template('<b>Hello {{name}}</b>!', name=name)
"""
Examples:
update_option( "foobar" )
update_option( 'your_mom_lol' )
update_option("another_func")
update_option('some_long_name')
Regex: