Skip to content

Instantly share code, notes, and snippets.

View alexgleason's full-sized avatar

Alex Gleason alexgleason

View GitHub Profile
@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 / 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 / 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 / ergodox-colemak.json
Last active May 5, 2018 18:37
Highly optimized Colemak layout for programming
{
"header": {
"Name": "MDErgo1",
"Variant": "standard",
"Layout": "Blank",
"Base": "Blank",
"Version": "0.1",
"Author": "HaaTa (Jacob Alexander) 2015",
"KLL": "0.3c",
"Date": "2015-09-12",
@alexgleason
alexgleason / getAlbumDownloadLinks.js
Last active October 6, 2016 10:41
Download Facebook albums
@alexgleason
alexgleason / _triangles.scss
Last active May 5, 2016 22:51
Make elements pointy
$triangle-size: 60px !default;
@mixin triangle($hexstring, $side) {
position: relative;
&::after {
content: '';
background-repeat: no-repeat;
display: block;
position: absolute;
background-position: bottom;
You: Yung Lean, will you go vegan?
Yung Lean: idk i Like meat tho
Yes, but _____ have feelings and do not want to die.
Animal species (plural): cows
You: Yes, but [cows] have feelings and do not want to die.
Yung Lean: ya [cows] iaght i smoked weed wit em but how Bout Milk tho aint hurt no1
The dairy industry is actually very cruel, they _____ cows.
@alexgleason
alexgleason / facebookGroupMemberNamesToCsv.js
Created May 23, 2016 02:39
Takes the names of group members in a Facebook group and prints them as CSV output.
/*
Takes the names of group members in a Facebook group and prints them as CSV output.
*/
function facebookGroupMemberNamesToCsv() {
var people = document.querySelectorAll('.fsl.fwb.fcb a');
var output = 'First Name,Last Name\n';
for (var i=0; i<people.length; i++) {
names = (people[i].innerHTML).split(' ');
output += names[0] + ',' + names[names.length-1] + '\n';
}
@alexgleason
alexgleason / hallowagtailinlineonly.js
Last active June 7, 2016 20:25
Hallo Wagtail inline only
(function() {
(function($) {
return $.widget('IKS.inlineonly', {
options: {
uuid: '',
editable: null,
buttonCssClass: null
},
populateToolbar: function(toolbar) {
var whitelist = [
@alexgleason
alexgleason / animal-struggles.md
Created July 31, 2016 19:14
Chris Palmeri animal liberation speak-out

We all have struggles. We’re all trying to live our lives. We all have things that we are each worrying about. And a lot of the time it feels like that’s too much. So I understand how hard it is to acknowledge that all around us is a world of unspeakable horror and torment. In every burger, every milkshake, every omelette, every leather jacket and fur coat, there is unspeakable suffering and violence. We are all animals, and we need to figure out what kind of world we want to live in. Do we want to live in the kind of world where if you’re born the wrong shape, or you have the wrong brain, or you live in the wrong place, you are considered worthless and expendable? When we look into the eyes of another animal be they our cats or dogs at home, or the cows, chickens, pigs, and fish that are confined and slaughtered by trillions in our food system, we are not just looking at some “thing,” some “other,” some resource to be thrown away. We are looking at a part of us. And when they are imprisoned, and when they ar