- A this allows people to comment on pull requests and include long snippets of code without making the discussion a mile and a half long.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function find_existing_files() { | |
# This prevents me from shooting myself in the foot when I'm | |
# grepping for a pattern and forget to include "-l" before | |
# using xargs to open the files in sublime | |
for filepath in $@; do | |
if [ -f $filepath ]; then | |
echo $filepath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller } from "@hotwired/stimulus" | |
// Connects to data-controller="active-link" | |
export default class extends Controller { | |
static values = { | |
activeClass: { type: String, default: 'active' } | |
} | |
connect() { | |
this._syncActive(document.location) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections.abc import MutableSet | |
class SingleEntrySet(MutableSet): | |
"""\ | |
I created this class for debugging. It works like a regular set but it | |
raises an error if it tries to add an item that is already present. | |
""" | |
__slots__ = ("__items",) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class memoized_property: | |
def __init__(self, method): | |
self.__method = method | |
prefix = method.__qualname__.rsplit(".")[0].replace(".", "__") | |
self.__name = '_%s__%s' % (prefix, method.__name__) | |
def __get__(self, obj, objtype=None): | |
if obj is None: | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import csv | |
import io | |
import json | |
import pdb | |
import sys | |
from collections import OrderedDict | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is just a demonstration of how to write an ierator from scratch */ | |
function range(limit) { | |
var i = 0; | |
return { | |
[Symbol.iterator]: function() { | |
return this; | |
}, | |
next: function() { | |
if (i < limit) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import GlimmerComponent from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
import EmberComponent from '@ember/component'; | |
import { action } from '@ember/object'; | |
import { guidFor } from '@ember/object/internals'; | |
import { addObserver } from '@ember/object/observers'; | |
function myAction(_target, _name, descriptor) { | |
const original = descriptor.value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import re | |
name = sys.argv[1] | |
def classify(name): | |
names = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import { task } from 'ember-concurrency'; | |
function* fetchStuff() { | |
console.log('In fetchStuff'); | |
yield *fetchMoreStuffGeneratorFn(); | |
// fetchMoreStuff(); | |
} | |
function* fetchMoreStuffGeneratorFn() { |