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
// Assumes consistent file names accross all image sequences (mine are zero-indexed and padded to five digits) | |
// mainCharacter.atlas | |
// - idleLoop_00000.png | |
// - idleLoop_00001.png | |
// - ... | |
// - walkLoop_00000.png | |
// - walkLoop_00001.png | |
// - ... | |
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 nltk | |
all_words = nltk.corpus.words.words() | |
jumbled_letters = "andrewtremblay" | |
anagram_results = [] | |
len_full_phrase = len(jumbled_letters) | |
letter_distribution = nltk.FreqDist(jumbled_letters) | |
trimmed_lowercase_wordlist = [w.lower() for w in all_words if len(w) <= len_full_phrase] |
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 nltk | |
all_words = nltk.corpus.words.words() | |
print len(all_words), "total words loaded" |
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 nltk | |
all_words = nltk.corpus.words.words() | |
print len(all_words), "total words loaded" | |
jumbled_letters = "andrewtremblay" | |
letter_distribution = nltk.FreqDist(jumbled_letters) | |
matching_wordlist = [w.lower() for w in all_words if nltk.FreqDist(w) <= letter_distribution] |
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 nltk | |
import functools | |
def memoize_anagrams(obj): | |
cache = obj.cache = {} | |
jumbled_args_index = 0 | |
@functools.wraps(obj) | |
def memoizer(*args, **kwargs): | |
if args[jumbled_args_index] not in cache: | |
cache[args[jumbled_args_index]] = obj(*args, **kwargs) |
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
the | |
of | |
to | |
and | |
a | |
in | |
is | |
it | |
you | |
that |
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
# Python 2.7.10 | |
# usage: | |
# python scrub_ghost.py my_ghost_export.json | |
# | |
# outputs to my_ghost_export_scrubbed.json | |
# takes a ghost export file and prepares the posts for import of into wp | |
# (see https://plugins.trac.wordpress.org/browser/import-from-ghost?order=name#trunk) | |
# removes the following unneeded information: | |
# draft posts |
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 django.db import models | |
from django.conf import settings | |
from rest_framework import viewsets, serializers | |
class CommonModel(models.Model): | |
"""Common fields that are shared among all models.""" | |
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, | |
editable=False, related_name="+") | |
updated_by = models.ForeignKey(settings.AUTH_USER_MODEL, |
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 CommonModel, CommonSerializer, CommonViewSet | |
# from https://gist.github.com/andrewtremblay/94c485f816f3095d7e86668b97b1a668 | |
class Note(CommonModel): | |
"""Note content, written by a user.""" | |
text_body = models.TextField(default="") | |
class NoteSerializer(CommonSerializer): | |
"""Serialize requests for Text Content.""" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer