Skip to content

Instantly share code, notes, and snippets.

View ArcTanSusan's full-sized avatar
🎯
Focusing

Susan Tan ArcTanSusan

🎯
Focusing
  • United States
  • 12:48 (UTC -05:00)
View GitHub Profile
@ArcTanSusan
ArcTanSusan / template_loaders_issue
Last active December 21, 2015 12:09
I'm not sure how to use the settings.TEMPLATE_LOADERS. Gah.
I'm not quite sure how to use the settings.TEMPLATE_LOADERS in L110:
settings.TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
)
),
)
Inside the test_loaders.py, I do a dir(loader) using pdb. And here are its methods:
@ArcTanSusan
ArcTanSusan / run template_tests stack trace
Created August 22, 2013 06:48
stack trace of when I run the template_tests
Susans-MacBook-Air:tests susantan$ ./runtests.py template_tests
Creating test database for alias 'default'...
Creating test database for alias 'other'...
..............................................................E.............................
======================================================================
ERROR: test_missing_template_is_cached (template_tests.test_loaders.CachedLoader)
Check that the missing template is cached.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/susantan/Projects/django/tests/template_tests/test_loaders.py", line 136, in test_missing_template_is_cached
@ArcTanSusan
ArcTanSusan / gist:6559344
Last active December 23, 2015 01:19
Get all the Friday the 13ths in the future. 1-line Python code.
# Cited Source: Raymond Hettinger's tweet on 9/13/2013 at 11:00PM.
from datetime import timedelta, date
friday_the_13ths = filter(lambda d: d.day==13, (date(2013, 9, 13)+timedelta(days=7)*i for i in range(1000)))
>>> friday_the_13ths
[datetime.date(2013, 9, 13), datetime.date(2013, 12, 13), datetime.date(2014, 6, 13),
datetime.date(2015, 2, 13), datetime.date(2015, 3, 13), datetime.date(2015, 11, 13),
datetime.date(2016, 5, 13), datetime.date(2017, 1, 13), datetime.date(2017, 10, 13),
datetime.date(2018, 4, 13), datetime.date(2018, 7, 13), datetime.date(2019, 9, 13),
@ArcTanSusan
ArcTanSusan / Git_Automation_with_IPython_notebook
Last active January 3, 2016 04:49
Automate your git workflow with the IPython notebook
# Problem Statement:
# You have mulitple copies (or clones) of upstream repositories in your local drive.
# Your local cloned repos need to be updated against the upstream master repos on a regular basis.
# Here's one solution that uses the IPython notebook.
# Open up your IPython notebook browser in your working directory and then paste the following into a code cell.
# Press SHIFT+ENTER to run the code cell.
# Create a list of projects located in the working directory.
list_of_projects = ["django", "ipython", "oh-mainline"]
@ArcTanSusan
ArcTanSusan / gist:8530182
Created January 20, 2014 22:07
A simple Brython widget: button and pagination. I am debugging the show_additional_comment event handler. I get the error "Uncaught Error: local variable 'count' referenced before assignment". Feel free to leave comments.
<html>
<head>
<script src="Brython1.4/src/brython.js"></script>
<link rel="stylesheet" type="text/css" href='css/pagination.css'>
</head>
<body onload="brython(2)">
<div class ="preloaded_comment" id="comment1">some sample comment #1 here</div>
<div class ="preloaded_comment" id="comment2">some sample comment #2 here</div>
<div class ="preloaded_comment" id="comment3">some sample comment #3 here</div>
{
"metadata": {
"name": "",
"signature": "sha256:025883229740ec0da175d59088cac88b2347cda445f6eb3bb7b65c99a2e43892"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@ArcTanSusan
ArcTanSusan / gist:f36cc0872d16116efdaf
Last active August 29, 2015 14:03
mysql master vs. mysql my_django_upgrade git diff comparison
5	5	  ERROR: test_submit_form (mysite.base.tests.Unsubscribe)
6	6	  ERROR: test (mysite.profile.tests.EditBio)
7	7	  ERROR: test (mysite.profile.tests.EditContactBlurb)
8	8	  ERROR: test_blurb_with_irc_info (mysite.profile.tests.EditContactBlurb)
9	9	  ERROR: test (mysite.profile.tests.EditHomepage)
10	10	  ERROR: test (mysite.profile.tests.EditIrcNick)
11	11	  ERROR: test (mysite.profile.tests.EditLocation)
12	12	  ERROR: test_settings_page_form (mysite.profile.tests.EditYourName)
13	13	  ERROR: test_tag_edit_once (mysite.profile.tests.Info)
@ArcTanSusan
ArcTanSusan / reply_to_recruiter_spam
Last active August 29, 2015 14:04
How I reply to recruiter spam and so should you!
I was so inspired by https://medium.com/queer-life/do-something-useful-with-those-recruiting-emails-f62d82e13c2d,
so here's my template that you can feel free to use, copy and/or edit --
Hello $RECRUITER_NAME of $COMPANY_NAME,
Thanks so much for reaching out. Quick questions before we set anything up:
1. Are the company's health plans fully trans-inclusive? Are transition surgeries and medical expenses related to transgender transitions 100% covered by the employer’s medical plans?
Unless an employer explicitly negotiates otherwise, health insurance companies will refuse to cover any medical treatment related to being transgender. This includes labs, hormone replacement, therapy and psychiatry, surgery, and more. Many plans include language that specifically excludes these treatments from coverage; those that don’t will often exclude them on the grounds that they’re “cosmetic.”
@ArcTanSusan
ArcTanSusan / accounts.tests.py
Last active August 29, 2015 14:05
OH/account/tests --> test_logout_web
# I use both django web-test AND django's client session to test that a user can be logged in and then logged out.
class Login(WebTest):
# {{{
fixtures = ['user-paulproteus', 'person-paulproteus']
def test_login(self):
user = authenticate(username='paulproteus', password="paulproteus's unbreakable password")
self.assert_(user and user.is_active)
def test_logout_web(self):
GET v1/hosts
{
"hosts": [
{
blah blah blah blah
blah blah blah blah
"uuid": "00000172-0017-0001-0010-000000000000",
"version": "4.3.42",
"frameworks": ["openstack", "spark"]
},