Skip to content

Instantly share code, notes, and snippets.

View donmccurdy's full-sized avatar

Don McCurdy donmccurdy

View GitHub Profile
@donmccurdy
donmccurdy / agnoster.md
Last active August 29, 2015 13:57 — forked from agnoster/README.md

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@donmccurdy
donmccurdy / .gitconfig
Last active August 29, 2015 13:57
My Git Configuration
[user]
name = <Your Name>
email = <you@email.com>
[color]
# Makes the CLI usable.
ui = true
[push]
default = upstream
[branch "master"]
##### ESSENTIAL. Gets rid of the spammy commits each time you pull.

get_field_replacement_value() → ???

Requirements

  • Provide displayable 'field values' for all field types (list, numeric, entity, image, url, ...)
  • Offer these values in multiple formats: DB value, HTML, markdown (for narratives), plaintext (e.g. for a mobile app).
  • Support normalized/denormalized data sources, given the original Item: plain field values from the table, images that require metadata, app data and entity fields that do lookups elsewhere, and ideally functions or collections that might be computed on the fly (see: UserExpressionFieldDef).
  • Other concerns: Help text, directory crosslinks.

Current Implementation

@donmccurdy
donmccurdy / Entity Fields and Attributes
Last active August 29, 2015 14:06
Entity Fields & Attributes
# Entity Fields & Attributes
> OVERVIEW: When entity fields are created pointing to an external Topic, the fields belonging to that topic can be used without needing to copy data back and forth. For documentation purposes, I'll refer to these secondary fields as "entity attributes."
Supported Features (9/3/2014):
* SRP, Map, Slideshow, Versus, and Detail Soft Joins
* SRP, Gallery View, and Map View templates
* Narratives
@donmccurdy
donmccurdy / shader-school-errors
Created February 15, 2015 22:52
Errors encountered while installing ShaderSchool
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/Users/donmccurdy/.npm/lib/node_modules/shader-school/node_modules/glslify-live/node_modules/chokidar/node_modules/fsevents/LICENSE'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
@donmccurdy
donmccurdy / keybase.md
Created February 23, 2015 06:44
keybase.md

Keybase proof

I hereby claim:

  • I am donmccurdy on github.
  • I am donmccurdy (https://keybase.io/donmccurdy) on keybase.
  • I have a public key whose fingerprint is 5F37 223F AA10 6848 06F7 5B7D 843F 566D 1AD4 B332

To claim this, I am signing this object:

@donmccurdy
donmccurdy / theme-scheme.md
Last active December 21, 2015 23:28
Theme Scheme

Theme Scheme

Basic Goals

  • Fast development
  • Flexible styling across domains

Overview

The idea is to create a single _common.scss file, which is included everywhere. _common.scss serves two purposes: to access re-usable SCSS mixins, and to @import one of several _palette.scss files.

@donmccurdy
donmccurdy / batch_updates_example.php
Last active December 24, 2015 13:19
Batch Query Updates (Example)
////// UPDATE APP DATA TABLE.
$old_app_data = db_query("SELECT key_id, value FROM {%s} WHERE data_id=%d ORDER BY key_id ASC;",
$def->app_data_table, $def->app_data_id);
$i = 1001;
$updates = [];
$mapping = [];
while ($row = db_fetch_array($old_app_data)) {
$mapping[$row['key_id']] = [
'old_key_id' => $row['key_id'],
$token = $stream->readToken();
if (strpos($token, '=') === 0) {
// Evaluate {{= field*2}}
$output .= $this->expression_parser->evaluate(substr($token, 1));
} else if (preg_match('/^#([\S]+)(?:[\s]+)([^\}\}]+)/', $token, $match)) {
// Block {{#blockType blockArg}}
$output .= $this->renderBlock($stream, $match[1], $match[2]);
@donmccurdy
donmccurdy / count-font-sizes.js
Created March 14, 2016 21:41
SO MANY FONT SIZES.
/**
* Count the number of distinct font sizes on the page.
*
* Tested in Chrome, no idea if this works elsewhere.
*
* @author Don McCurdy <dm@donmccurdy.com>
*
*/
var sizes = {};
for (var i = 0; i < document.styleSheets.length; i++) {