Skip to content

Instantly share code, notes, and snippets.

Jessamyn Smith jessamynsmith

Block or report user

Report or block jessamynsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:67344a7c26cef59a273ec76ab64a2992
#!/usr/bin/env bash
# Bash scope experiments
func ()
echo "in func: param1: $1, param2: $2, var1: $var1, var2: $var2"
View Promise test
function myAsyncFunction(url) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();"GET", url);
xhr.onload = () => resolve(xhr.responseText);
xhr.onerror = () => reject(xhr.statusText);
View See types of attributes on a Python class
>>> class MyClass:
... """ hello """
... attr1 = 'hello'
... attr2 = 23
... def method1(self):
... return self.attr1
... def __str__(self):
... return '{} {}'.format(attr1, attr2)
jessamynsmith / gist:32afb8a05d7b59965e6dbf48852acabc
Created Sep 27, 2018
Installing mysqlclient with python3 on OSX
View gist:32afb8a05d7b59965e6dbf48852acabc
$ pip install mysqlclient
Collecting mysqlclient
Using cached
Building wheels for collected packages: mysqlclient
Running bdist_wheel for mysqlclient ... error
Complete output from command /Users/jessamyn/.virtualenvs/django-mysql-test/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/nj/cf50gt6s7x97fk9gqg7h6xr00000gn/T/pip-install-0d9salg8/mysqlclient/';f=getattr(tokenize, 'open', open)(__file__);'\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/nj/cf50gt6s7x97fk9gqg7h6xr00000gn/T/pip-wheel-bgng27ta --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
View How to Debug an Exception
1. Read the stack trace carefully. In particular, look for:
a) The name and text of the exception
b) Where the trace enters your code
2. Go to the lowest level in your code that the stack trace showed
3. Look carefully at the line of code throwing the error, and the preceeding lines, and see if you can see how they relate to the exception you got.
4. Try to imagine what values the variables might have had at this point, to generate the exception you saw.
5. If you have a debugger, set a breakpoint on this line and inspect all relevant variables. If you don’t have access to a debugger, print out the values of the variables.
6. If you can see a value that looks bad, follow that variable up through the program to see where it came from and why it’s incorrect.
7. If you can’t see any values that look bad, rethink you assumptions about what caused the error.
View gist:2a92920f011c382370e0
from codementor import models as codementor_models
from django.db.models import Sum
payments = codementor_models.Payment.objects.all().order_by('date')
payment_values = payments.values_list('date').annotate(total_earnings=Sum('earnings'))
jessamynsmith / gist:9482c1ff01720af385da
Created Oct 23, 2015
Error when clicking sidemenu entry in project run in iOS simulator with XCode 7
View gist:9482c1ff01720af385da
[Error] Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []$rootScope/infdig?p0=10&p1=%5B%5D
View index.html
<div class="container">
<div class="big">
<div class="medium">
<div class="small">
jessamynsmith / gist:5334087
Created Apr 8, 2013
South import failing, due to earlier mangling of modules by nose
View gist:5334087
Traceback (most recent call last):
File "/Applications/", line 113, in <module>
File "/Applications/", line 89, in execute
File "/Users/jessamyn/.virtualenvs/MapStore/lib/python2.7/site-packages/django/core/management/", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/jessamyn/.virtualenvs/MapStore/lib/python2.7/site-packages/django/core/management/", line 220, in execute
output = self.handle(*args, **options)
File "/Applications/", line 76, in handle
You can’t perform that action at this time.