Skip to content

Instantly share code, notes, and snippets.

View jason-curtis's full-sized avatar

Jason Curtis jason-curtis

View GitHub Profile
@jason-curtis
jason-curtis / Statsmodels Issue 987 - formula support in wls_prediction_std.ipynb
Last active August 29, 2015 13:58
Statsmodels Issue 987 - formula support in wls_prediction_std (2)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jason-curtis
jason-curtis / gist:3dfaa704e9da5bd08e44
Last active August 29, 2015 14:06
trash talk colorize function
from components.cards import Color
from components.style import redify, blueify
trash_talked = set()
def _trash_talk(color, *messages):
colorize = redify if color == Color.red else blueify
full_message = ' '.join(map(str, messages))
if full_message in trash_talked:
return
# couple things I'd throw in there:
# moar whitespace
res = [
[
[
kriger.predict(x,y,z)
for x in grid[0]
]
for y in grid[1]
]
extends:
- eslint-config-airbnb
- plugin:import/errors
- plugin:import/warnings
parser:
babel-eslint
settings:
ecmascript: 6
@jason-curtis
jason-curtis / roman_test.py
Last active June 20, 2018 21:21 — forked from vralex/roman_test.py
Dive into python 3 example. Unit testing.
__author__ = 'VladimirDel'
import roman
import unittest
class KnownValues(unittest.TestCase):
known_values = ( (1, 'I'),
(2, 'II'),
(3, 'III'),

These are standards that we came up with at Osmo Systems to allow technicians to use Jupyter notebooks to run experiments, while maintaining quality standards to avoid bugs and promote readability and reusability.

Each experiment we did was saved in a shared Google Drive folder, which contained a README entry point and any supporting notebooks and other files.

Standard Notebook Practices

  • In general, see Code Style Manifesto
  • Write code conforming to Pep8, e.g. imports, top-level constants
  • Black code formatting is preferred. You can add a black formatting button to your notebook with this tool.
  • Self-documentation: Someone else (or yourself in 3 months) should be able to open the notebook and know wtf is going on and why. Note: your README is the standard entry point for understanding the experiment at a high level (so that you don’t need jupyter to understand the purpose and basi
@jason-curtis
jason-curtis / bisect_example.py
Created January 21, 2020 23:21
bisect example
import bisect
def value_is_present(list_, value):
insertion_point = bisect.bisect_left(list_, value)
return (
# If value is larger than all values in list_, it will be len(list_)
insertion_point < len(list_)
and arr[insertion_point] == value
)
@jason-curtis
jason-curtis / hypothesis_example.py
Created January 21, 2020 23:22
Simple example of how to use hypothesis library
import hypothesis
@hypotheis.given(hypothesis.strategies.text())
def test_my_function_returns_string_input(s):
assert my_function(s) == s
# Tests your “hypothesis” with a whole bunch of different types of garbage.
my_function()
import heapq
# you have to create the list yourself
heap = [some list]
# heapq will modify your list in place!
# Organize the heap as a heap.
# Worst case time complexity: O(n log(n))
# Average time complexity: O(1)