Skip to content

Instantly share code, notes, and snippets.

View kentquirk's full-sized avatar

Kent Quirk kentquirk

View GitHub Profile
@kentquirk
kentquirk / unitstest.py
Created May 27, 2014 13:40
Shows how storing data in ints is a problem but in floats works just fine
# This is a small program that tests conversion to and from different formats
# and makes sure that numbers that undergo conversion don't lose precision.
import math
# truncates a number to the given number of digits after the decimal
def truncate(x, digits):
p = math.pow(10, digits)
return int(x * p)/p
@kentquirk
kentquirk / dumpVars.py
Created March 7, 2014 18:18
Get a list of non-callable items from an object and return their names and values
import os.path
def dumpVars(r):
apivars = [(k, type(getattr(r, k))) for k in dir(r) if not k.startswith('_') and not callable(getattr(r, k))]
values = [(k[0], getattr(r, k[0])) for k in apivars]
return values
print dumpVars(os.path)
@kentquirk
kentquirk / MakeVsGrunt.md
Last active December 24, 2015 23:29
Build tools discussion for Tidepool

Build tools -- Make vs Grunt (vs Ant or other options)

We need to make a decision about build tools.

  • Make: venerable, but crusty. Dependency model doesn't work for a lot of things (you just have a list of commands). Not effectively cross platform -- Windows users in particular don't work well with make. Bit of a pain to set up but doesn't create additional dependencies. Everyone knows how to do easy stuff, but hard stuff can get really hard and ugly.
  • Grunt: the tool of choice for node projects. We're a node project. Cross platform. Pulls in lots of dependencies if you install it locally. Easy to set up the grunt files badly.
  • Pure JS scripts -- requires a little more scaffolding to set up; Grunt has that built in. Why bother? (See article below for one person's take on why he bothered.)
  • Jake: it's basically trying to do a make-like design but using javascript. Some good ideas, but like make, complex stuff requires a PhD to pull off.
  • Ant or Maven or
@kentquirk
kentquirk / tidepool_dummy_api.md
Last active December 24, 2015 06:19
Task list and discussion for Tidepool's dummy API

dummy-api

All our techniques are being tested and documented in the repository called dummy-api.

  • Set up gruntfile structure
  • JSHint / code formatting documentation
  • JSHint gruntfile
  • Set up documentation with docco
  • docco gruntfile
  • License template system built