Skip to content

Instantly share code, notes, and snippets.

View ChrisWellsWood's full-sized avatar

Christopher W. Wood ChrisWellsWood

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ChrisWellsWood
ChrisWellsWood / imp_loop.py
Created August 25, 2016 07:46
A simple imperitive loop
my_numbers = [0, 1, 2, 3, 4, 5]
odd_number_count = 0
for number in my_numbers:
if number % 2:
odd_number_count += 1
print(odd_number_count)
@ChrisWellsWood
ChrisWellsWood / reading_types.elm
Last active August 25, 2016 23:12
Reading Types in Elm
> "This is a string"
"This is a string" : String
> 2.71828
2.71828 : Float
> 123
123 : number
> [1, 2, 3, 4, 5]
@ChrisWellsWood
ChrisWellsWood / type_annotations.elm
Last active August 29, 2016 14:13
Type annotations in Elm
doubleIt : number -> number
doubleIt n = n * 2
import String
stringify : number -> String
stringify n = toString n
addX : String -> String
addX s = s ++ "X"
@ChrisWellsWood
ChrisWellsWood / complex_data_type_annotations.elm
Last active August 29, 2016 14:50
Complex Data and Type Annotations
import String
import Html
import List
type alias Person = { name : String
, access : List String }
type alias Location = String
ee1 = { name = "Ian Beal"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ChrisWellsWood
ChrisWellsWood / crangles_to_register.py
Last active January 4, 2017 16:15
Extract a register from a list of Crick angles.
def fit_heptad_register(crangles):
"""Attempts to fit a heptad repeat to a set of Crick angles.
Parameters
----------
crangles: [float]
A list of average Crick angles for the coiled coil.
Returns
-------
fit_data: [(float, float, float)]
Sorted list of fits for each heptad position.
@ChrisWellsWood
ChrisWellsWood / elm-local-storage.html
Created July 4, 2017 09:21
Catch error with local storage for Elm app
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="elm.js"></script>
</head>
<body></body>
<div id="main"></div>
<script type="text/javascript">
var node = document.getElementById('main');
@ChrisWellsWood
ChrisWellsWood / 1_pypi_dist.md
Last active August 17, 2017 08:49
Packaging a Python Project and Distributing on PyPi

Packaging a Python Project and Distributing on PyPi

Workflow

  1. Create setup.py
    • Contains information about your project i.e. version numbers, licences, Python version
  2. Create MANIFEST.in
    • Defines files to be included/excluded from the package
    • See example below.
  3. Run create the distribution