Skip to content

Instantly share code, notes, and snippets.

View jasonamyers's full-sized avatar

Jason Myers jasonamyers

View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@jasonamyers
jasonamyers / sentiment-notrain.py
Created May 13, 2016 03:17
Playing with textblob
# coding: utf-8
# In[20]:
from textblob import TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
# In[2]:
@jasonamyers
jasonamyers / proposal.md
Created April 8, 2016 13:46
Talk proposal

Testing python applications can be confusing, and leave you in a daze about what the proper way to test when create an API or access a remote service. Let's explore the testing world with a gentle introduction to unittest, py.test, mock, gabbi, and betamax. We'll learn how to isolate our tests from databases, APIs and third party libraries. We'll also look at some common tricks you might need when testing your python application including raising exceptions, validating exceptions, and return different values for each call to a function.

Outline

  • Introduction to testing in Python
  • Creating our first test
  • Mocking
    • Using our first mock
    • Mocking Builtin functions like open
  • Raising an error to test error handling
@jasonamyers
jasonamyers / Keyboards
Last active March 10, 2016 16:34
The Keyboards History
Code 87 With Greens http://imgur.com/QYh63bM
KB Paradise V60 with Clears http://imgur.com/rdzwXMH
CM Storm NovaTouch http://imgur.com/4Z9MgeG
HHKB Type-S Used http://imgur.com/KKGA78b
KUL with Browns http://imgur.com/W6qseke
V60 with Matias Quiet Clicks http://imgur.com/FiXIfqX
Atomic with Clears http://imgur.com/xXXnKgd
Planck with Matias Quiet Clicks http://imgur.com/8uJ9eRi
Ergodox - Greetech Brown* http://imgur.com/AZSZ05U
HHKB Type-S New http://imgur.com/2LzbWcb
In [1]: import random
In [2]: """
...: """
Out[2]: '...'
In [3]: entries = Out[2].splitlines()
In [4]: entries
Out[4]:
@jasonamyers
jasonamyers / .pre-commit-config.yaml
Created January 29, 2016 03:39
An example pre-commit config file setup for flake8, debug, and merge conflict with an example base prospector config
- repo: git://github.com/pre-commit/pre-commit-hooks
sha: 'cf550fcab3f12015f8676b8278b30e1a5bc10e70'
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: flake8
#- repo: git://github.com/guykisel/prospector-mirror
#sha: '00fbd80101566b1b9c873c71f2ab7b95b8bd0a7d'
#hooks:
#- id: prospector
@jasonamyers
jasonamyers / SQALE-Python.md
Last active November 29, 2015 16:09
A proposed list of Python rules

Critical

Issue Default
Methods and field names should not differ only by capitalization n/a
Conditions in related "if/elif/else if" statements should not have the same condition n/a
"return" and "yield" cannot be used in the same function n/a
"exit" should accept type, value, and traceback arguments n/a
"init" should not return a value n/a
from sqlalchemy import and_, or_, not_
q = select([tblthing.c.id, tblthing.c.zip, tblthing.c.structure])
conditions = or_()
for row in df.iterrows():
conditions.append(and_(tblthing.c.id=row['id'], tblthing.c.zip=row['zip']))
q = q.where(conditions)
@jasonamyers
jasonamyers / SassMeister-input.scss
Created November 20, 2014 14:57
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
.form-control::-webkit-input-placeholder {
color: #b22126;
}
.form-control:-moz-placeholder { /* Firefox 18- */