This file contains hidden or 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 pprint | |
| def nested_tree(edges): | |
| nested = {} | |
| for from_, to in edges: | |
| value = {} | |
This file contains hidden or 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
| I'm here to help you succeed. It's not about me, it's about you. If I ever make you feel less than, or someone makes you feel that way, tell me. I'm happy to be corrected when I screw up. My entire purpose in working with Hackbright is to do something concrete to improve the field and the future that we're building together. You are a part of that future. |
This file contains hidden or 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
| find . -not \( -path '*node_module*' -o -path '*.git*' -o -path '*jasmine*' -o -path '*assets*' -o -type d \) | xargs grep -in -E '(\bhe\b)|(\bhis\b)|(\bher\b)|(\b\she\b)' |
This file contains hidden or 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
| def uncompress_string(c): | |
| from io import BytesIO | |
| from gzip import GzipFile | |
| zbuf = BytesIO(c) | |
| with GzipFile(mode='rb', compresslevel=6, fileobj=zbuf) as zfile: | |
| return zfile.read() | |
| class ForceDebugJSONMiddleware(object): | |
| def process_response(self, request, response): | |
| """Add html, head, and body tags so debug toolbar will activate.""" |
This file contains hidden or 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
| depends_on = ( | |
| ('about', '0004_fake_user_fk'), | |
| ('accounts', '0029_auto__del_registration'), | |
| ('activity_feed', '0002_fake_user_fk'), | |
| ('analytics', '0006_add_labels'), | |
| ('art', '0036_auto__chg_field_packpurchase_royalty_millicents_per_credit__chg_field_'), | |
| ('bots', '0002_fake_user_fk'), | |
| ('comments', '0002_fake_user_fk'), | |
| ('core', '0012_auto__del_field_creatorprofile_points_balance__add_field_creatorprofil'), | |
| ('creator', '0002_fake_user_fk'), |
This file contains hidden or 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 psycopg2.extras import DictCursor | |
| from django.db import connections | |
| def get_cursor(alias='default', cursor_factory=None): | |
| # map from django's ORM layer to the raw DB cursor. | |
| wrapped_conn = connections[alias] | |
| # hack to ensure connection is immediately opened: | |
| if wrapped_conn.connection is None: |
This file contains hidden or 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
| def uncompress_string(c): | |
| from io import BytesIO | |
| from gzip import GzipFile | |
| zbuf = BytesIO(c) | |
| with GzipFile(mode='rb', compresslevel=6, fileobj=zbuf) as zfile: | |
| return zfile.read() | |
| class ForceDebugJSONMiddleware(object): | |
| def process_response(self, request, response): | |
| """Add html, head, and body tags so debug toolbar will activate.""" |
This file contains hidden or 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
| test: | |
| override: | |
| - find . -maxdepth 1 -type d -not -name . > test_dirs: | |
| parallel: true | |
| - python circle_node_to_dirs.py < test_dirs > test_dirs_for_node: | |
| parallel: true | |
| - echo "Testing `cat test_dirs_for_node`": | |
| parallel: true | |
| - py.test `cat test_dirs_for_node`: | |
| parallel: true |
This file contains hidden or 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
| $ find . -name '*.html' | xargs grep -h '{% extends' | sed -e "s/'/\"/g" | sort | uniq -c | sort -n | |
| 1 <!DOCTYPE html>{% extends "common/templates/responsive_base.html" %} | |
| 1 {% extends "admin/change_form.html" %} | |
| 1 {% extends "admin/index.html" %} | |
| 1 {% extends "base.html" %} | |
| 1 {% extends "common/templates/blank.html" %} | |
| 1 {% extends "common/templates/donut-base.html" %} | |
| 1 {% extends "messaging/templates/email/base_ss_email_to_user.html" %} | |
| 1 {% extends "provider/templates/preview_base.html" %} | |
| 1 {% extends "rate-appointment-form-base.html" %} |
This file contains hidden or 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
| def instance_in_qs(instance_or_pk, qs): | |
| if qs._result_cache is None: | |
| if qs.query.can_filter(): | |
| pk = getattr(instance_or_pk, 'pk', instance_or_pk) | |
| return qs.filter(pk=pk).exists() | |
| else: | |
| objs = list(qs) | |
| else: | |
| objs = qs._result_cache | |