Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@robcmills
robcmills / gist:cd93175f9d3d5a22eea5
Last active August 29, 2015 14:17
how the Go Game app gets media

user clicks on HTML file input element

<form enctype="multipart/form-data" class='media-upload-form'>
<div class='upload_container'>
  <input type="file" name="file" 
    id="fileUpload{{unbound view.elementId}}"
    accept="{{unbound view.accept}}">
</div>

where view.accept = 'video/*' or 'image/*'

@robcmills
robcmills / forge.gg.getVideo.md
Last active August 29, 2015 14:17
Go Game Custom Forge Camera Module API Specification

GoGame Custom Forge Video Module Specification

V-0.3

Author: rob@thegogame.com

forge.gg.getVideo([options], success, error) iOS

@robcmills
robcmills / gist:d18b5244731047ed5749
Created April 1, 2015 19:59
Go Game Flavors Organizations Migration
from models.models import Flavor, Organization
organizations = Organization.objects(title__ne='Go Game USA')
flavor_ids = ['54e394b30df8257c2019fa19', '53ffbf1c129d7c22a3c98981', '54dd3fd80df8257c2019f9e9', '541fb9b7129d7c0a54f63c21', '549467030df8252dd18c64df']
flavors = Flavor.objects(id__in=flavor_ids)
for org in organizations:
@robcmills
robcmills / multi-tenancy-migration.py
Last active August 29, 2015 14:18
Mezzanine site tree multi-tenancy data migration
# execfile('/Users/gogamedesign/newsite/website-bravo/misc/09ee79d18f126006216d/multi-tenancy-migration.py')
from gogame_app.models import *
from gogame_gallery.models import *
from mezzanine.blog.models import *
from django.contrib.sites.models import Site
from django.conf import settings
from django.contrib.redirects.models import Redirect
from mezzanine.pages.models import Page
@robcmills
robcmills / camera-submit-codepath.js
Created September 9, 2015 01:49
selected code from codepath following bonus cam media submission to retry upload
// file input element gets media
// submission_media.hbs line:36
<form enctype="multipart/form-data" class='media-upload-form'>
// submission_media.js line:134
fileDidChange: function() {
//...
this.setFile(file);
@robcmills
robcmills / trim-html.js
Last active December 16, 2015 17:44
Simple function to trim html content to a specified length.
// var htmlIn = '<div>Hello world!</div>';
// var htmlIn = '<div>Hello <b><i>world!</i></b></div>';
// var htmlIn = '<div><ol><li>Hello</li><li><b>world!</b></li></ol></div>';
// var htmlIn = '<div>1</div><div>2</div><div><br/></div><ol><li><b><i>Hello<i><b></li><li><b>world!</b></li></ol></div>';
var htmlIn = '<div>Hello </div><div><br/></div><div>world!</div>';
var trimTo = 8; // trim to this length
var trimHtml = function(html, trim) {
@robcmills
robcmills / colorful-git
Created January 14, 2016 22:44
colorful git
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@robcmills
robcmills / catan-castles-and-armies.md
Last active March 15, 2016 16:11
Catan Castles & Armies

Catan Castles & Armies

Unless noted here, Catan Castles & Armies follows all the rules of regular Catan

Overview of changes:

  • buildings (settlements, cities, armies) are placed in the center of hexes instead of at the intersections
  • no distance rule (except for initial placement)
@robcmills
robcmills / catan-conquest.md
Last active March 17, 2016 06:54
Conquest of Catan. Build, attack, conquer.

Catan Conquest

The objective of Catan Conquest is to grow your army, claim the most land, defeat your enemies, and conquer the island of Catan.

Overview of changes:

  • resource production refactor (see Resources section below)
  • settlements, cities, & armies are placed in the center of hexes instead of at the intersections
@robcmills
robcmills / smart-component-style.js
Created August 26, 2016 20:36
smart component style - class vs functional with flow and lifecycle
// https://github.com/BuildingConnected/client/pull/1648
// apps/main/new-prequals/dashboard/vendor/modal/notes.js
const Notes = ({
...props,
}) => (
<div className={classes.root}>
{/*...*/}
</div>
)