Skip to content

Instantly share code, notes, and snippets.

Build things to better the world.

Blaine Garrett blainegarrett

Build things to better the world.
View GitHub Profile
blainegarrett / stats_created_per_gallery
Created Jun 11, 2018
Number of events per gallery
View stats_created_per_gallery
blainegarrett /
Created Apr 23, 2018
Remote Console Script to Dump Pref Data to CSV
# Generate a csv of the prefs data
# In the ./app dir execute: -s
import csv
from api.entities import PreferenceEntity
from rest_core.utils import get_resource_id_from_key
q = PreferenceEntity.query()
cursor = None
blainegarrett / sdk_options_hack.txt
Created Apr 7, 2018
App Engine SDK OPTIONS /_ah/upload/ hack
View sdk_options_hack.txt
if environ['REQUEST_METHOD'] == 'OPTIONS' and environ['REQUEST_URI'][0:12] == '/_ah/upload/':
logging.warning("Hacked OPTIONS request for /_ah/upload - see module.828")
wrapped_start_response('200 SUPER GREAT',
('Access-Control-Allow-Origin', '*'),
('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE'),
('Access-Control-Allow-Credentials', 'true'),
('Content-Type', 'application/json'),
('Access-Control-Allow-Headers', '*'),
blainegarrett / stats_created_per_month
Last active Jun 11, 2018
Calculate # of events created per month
View stats_created_per_month
# In the ./app dir execute: -s
# Script to get all the events listed by when they were posted
from import EventEntity
q = EventEntity.query()
hist = {}
cursor = None
more = True
blainegarrett / grid.js
Created Mar 19, 2018
Material UI Next classic Grid Iterface
View grid.js
import React from 'react';
import PropTypes from 'prop-types';
import MuiGrid from 'material-ui/Grid';
import { withStyles } from 'material-ui/styles';
import classNames from 'classnames';
const styles = (theme) => {
// console.log(theme.spacing.unit);
// theme.spacing.unit * 2
blainegarrett /
Last active May 9, 2017
Divining Rod Survey Data Sync
import csv
import requests # installed (pip install requests)
import json
INPUT_FILE = './data/diving-rods-survey-data-2017-04-24.csv'
PREF_API_URL = 'http://localhost:9090/api/rest/v1.0/preferences'
def submit_pref_data(data):
View react_img_loader.js
// Simple React Class for managing the loading state of an image asset
var ImgLoader = React.createClass({
loadHandler: function () {
this.setState({img_loaded: true});
getInitialState: function () {
return {
loading_src: '',
img_loaded: false
blainegarrett /
Created Aug 31, 2016
Instagram Assemble
Initial draft of helper code to create an 700x700 instagrammable image coponsed of other cover images.
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from math import ceil