Skip to content

Instantly share code, notes, and snippets.

View alexgleason's full-sized avatar

Alex Gleason alexgleason

View GitHub Profile
@alexgleason
alexgleason / free-culture-altruism.md
Last active April 1, 2016 22:28
About free culture, anarchism, and altruism

Hey friend. Something I've been thinking about lately is altruism. I think altruism is the defining characteristic of a good society. Our society isn't really conducive to it, since capitalism presents everything like a contest. In a contest you have to beat everyone.

I think people hate socialism because it's a form of forced altruism. The altruists don't care because it's what they'd do anyway. Lately I've been reading about anarchism, which is an idealistic compromise. The idea is to build our society in such a way that it's conducive to altruism, which will encourage the most people to contribute. We wouldn't have to force them, because they'd all do it on their own if we teach them how, and if we built the society the right way.

I think it's possible, though maybe not within our lifetimes. Anyway, all that was to lead into something more relevant: the altruists we have now. There is an underground society of altruists, mostly on the internet, who are actively making contributions to make the world bett

@alexgleason
alexgleason / programming-for-humans.md
Last active April 1, 2016 22:31
Programming for Humans

Programming for Humans

This article is a recollection of my struggles to understand programming, and will hopefully aid people who are new to the craft. I hope it challenges anyone with experience, too.

How code relates to the physical world

The biggest problem I faced when learning how programming works is understanding how everything relates back to life and reality. Many tutorials show you how to achieve things with programming languages, but they don't explain why those things work. At some point it becomes about memorizing commands. In order to feel comfortable I feel like you really need to see the bigger picture.

There is a range of understanding starting from the code on your computer screen, all the way down to the electrons inside of the computer that make your code work. You may want to have at least a basic understanding of every step between. Without this knowledge, you risk becoming an [expert beginner](http://www.daedtech.com/how-developers-stop-learning-rise-of-the-expert-beginner/

@alexgleason
alexgleason / highlight_matches.py
Created March 10, 2016 16:57
Highlight search result match text in Python
import re
def highlight_matches(query, text):
def span_matches(match):
html = '<span class="query">{0}</span>'
return html.format(match.group(0))
return re.sub(query, span_matches, text, flags=re.I)
@alexgleason
alexgleason / cards-block.py
Created March 2, 2016 19:31
WIP custom cards block
from wagtail.wagtailcore.blocks import (
ListBlock,
StructBlock,
CharBlock,
TextBlock,
PageChooserBlock
)
from wagtail.wagtailimages.blocks import ImageChooserBlock
@alexgleason
alexgleason / m2m.py
Last active May 9, 2023 17:49
Many to many relationships in Wagtail
from django.db import models
from wagtail.wagtailsnippets.models import register_snippet
from wagtail.wagtailcore.models import Page
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import InlinePanel
@register_snippet
class Category(models.Model):
@alexgleason
alexgleason / ergodox-infinity-colemak.json
Created February 14, 2016 04:29
A hacker's keyboard layout
{
"header": {
"Author": "Alex Gleason",
"Base": "Blank",
"Date": "2015-09-12",
"Generator": "KIICONF 0.2",
"KLL": "0.3c",
"Layout": "Default",
"Name": "MDErgo1",
"Version": "0.1"
@alexgleason
alexgleason / neat-flex-grid.scss
Created February 1, 2016 04:35
Bourbon/Neat Flexbox Grid
/*
Based on code by Kevin Lamping
source: http://codepen.io/klamping/pen/waMOeX
*/
@mixin flex-grid {
display: flex;
flex-wrap: wrap;
margin-left: -$gutter;
margin-top: -$gutter;
@alexgleason
alexgleason / file-extensions.json
Last active December 14, 2018 02:54
Human readable descriptions for file extensions. Scraped from https://en.wikipedia.org/wiki/List_of_filename_extensions
{"DD": [{"description": "Macintosh file archive", "used_by": "DISKDOUBLER"}], "CHZ": [{"description": "Archive", "used_by": "CHARC"}], "EUI": [{"description": "Ensoniq EPS family CD image", "used_by": "AWAVE"}], "INI": [{"description": "Initialization file", "used_by": ""}], "CHI": [{"description": "ChiWriter Document", "used_by": "ChiWriter - Chiview"}], "OCT": [{"description": "Musical file", "used_by": "Pctalizer"}], "GFO": [{"description": "SGI Radiosity", "used_by": ""}], "QVD": [{"description": "QlikView Document (Data)", "used_by": "QlikView Compressed Database File"}], "MCW": [{"description": "Text file", "used_by": "MacWrite II"}], "HI": [{"description": "Game high scores table", "used_by": ""}], "ZUR": [{"description": "High level compressed file", "used_by": ""}], "FPU": [{"description": "Configuration file", "used_by": "FoxPro for Unix"}], "F": [{"description": "Archive", "used_by": "FREEZE"}, {"description": "Forth language source code file", "used_by": "Forth development systems"}, {"description
@alexgleason
alexgleason / vegan.md
Last active April 12, 2017 14:11
A response to "but humans need meat"

American Dietetic Association

It is the position of the American Dietetic Association that appropriately planned vegetarian diets, including total vegetarian or vegan diets, are healthful, nutritionally adequate, and may provide health benefits in the prevention and treatment of certain diseases. Well-planned vegetarian diets are appropriate for individuals during all stages of the life cycle, including pregnancy, lactation, infancy, childhood, and adolescence, and for athletes.

Dietitians of Canada

A well planned vegan diet can meet all of these needs. It is safe and healthy for pregnant and breastfeeding women, babies, children, teens and seniors.

The British National Health Service

@alexgleason
alexgleason / dev-prod-considerations.md
Last active August 29, 2015 14:24
Dev <-> Prod Considerations

Dev <-> Prod Considerations

  • robots.txt
  • Analytics snippets