Skip to content

Instantly share code, notes, and snippets.

View robinsax's full-sized avatar

robin saxifrage robinsax

  • Islands, BC
View GitHub Profile
@robinsax
robinsax / cities-by-state-index.yaml
Last active December 18, 2018 19:02
U.S. cities and their state scrapped from Wikipedia. Includes a first 2 character index for real-time search, where entries are the index of the city in the cities list. See below for usage example.
cities:
- [Malvern, 0]
- [Newville, 0]
- [Coker, 0]
- [Creola, 0]
- [Forkland, 0]
- [Florence, 0]
- [Kinston, 0]
- [Toxey, 0]
- [Banks, 0]
@robinsax
robinsax / googleapiclient_instance_wrap.py
Last active August 8, 2018 09:05
Lightweight, unoptimized wrap of googleapiclient basic instance control
# A small script that wraps the basic functionality of the
# (in my option somewhat confusing) googleapiclient features
# for instance control.
import time
from googleapiclient import discovery
cloud_config = dict(
project='My-Project',
@robinsax
robinsax / site-enabled-template
Last active August 4, 2018 19:26
Template for canvas sites-enabled entries in nginx that are SSL certified with letsencrypt
server {
listen 80;
server_name DOMAIN.com;
rewrite ^/([^(?:.well\-known)].*) https://DOMAIN.com/$1 permanent;
location ~ /.well-known {
root PATH_TO_VERIFY_DIR;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/tmp/canvas.sock;
@robinsax
robinsax / callable_objects.coffee
Last active March 7, 2018 01:40
An implementation of callable objects in CoffeeScript
# Callable objects like jQuery's $ are cool but tricky to implement. Here's
# an example of a class "decorator" that makes classes callable.
#
# The limitation is it will break typeof and instanceof checks against the
# resulting object.
# A class decorator to make instances callable.
# Calling instances will invoke their _call() method.
callable = (Class) ->
() ->