Skip to content

Instantly share code, notes, and snippets.

$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(x):
... return x + a
...
>>> f.func_code.co_names
('a',)
>>> f.func_code.co_varnames
@jml
jml / gist:25166ff19edc724a2964
Created August 3, 2014 13:17
Two very similar quickcheck properties
type Transformation a = (TodoFile -> a -> (TodoFile, [TodoEvent]))
-- XXX: If there were something that was like 'map f' but when given a
-- non-list would lift to a list and return a singleton, that would make this
-- more generic.
prop_emptyUnchanged_multiple :: Transformation [Int] -> Property
prop_emptyUnchanged_multiple transformation =
property $ \items -> transformation emptyFile items `shouldBe` (emptyFile, map NoSuchTask (nub items))
$ pip install ggplot
Downloading/unpacking ggplot
Downloading ggplot-0.5.8.tar.gz (5.7MB): 5.7MB downloaded
Running setup.py (path:/Users/jml/envs/notebooks/build/ggplot/setup.py) egg_info for package ggplot
Requirement already satisfied (use --upgrade to upgrade): six in ./lib/python2.7/site-packages (from ggplot)
Downloading/unpacking statsmodels (from ggplot)
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/Users/jml/envs/notebooks/build/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
# XXX: Make an HTML-level cleaner that converts:
# - <span style="font-family: Courier New, Courier, monospace;"> to <code>
# - <span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> to nothing
# - &nbsp; to a literal space
# - <div> or <p> containing only <code> & <br> into a <pre>
#
# See if that cleans up ~ & $ escaping.
#
# If not, do a post-import Markdown cleanup

Keybase proof

I hereby claim:

  • I am jml on github.
  • I am jml (https://keybase.io/jml) on keybase.
  • I have a public key whose fingerprint is D3B6 604B 81B4 C7D4 43F5 3D5D AA23 EC3C 2A72 7997

To claim this, I am signing this object:

Design choices

  1. The signs/symptoms/plans split is a different kind of discussion to the rest in this document

  2. I'm not sure I really understand why Atom / PSHB is "more ugly than webhooks" since PSHB uses webhooks. Also I'm not sure what we'll be using Atom for

  3. And again, I'm not sure why PSHB for events rather than pure webhooks

  4. There's still an open question as to languages, web servers / frameworks

Manifesto feedback

Intro

This is my feedback on the Causes manifesto. The points are numbered for easier discussion, and are a mix of questions, suggestions, observations and so forth. I'd like to actually have a stab at applying them.

I think a good way of incorporating this feedback is for me to make the following set of patches: a. Change Manifesto.md to wrap at 78 columns b. Apply the formatting / grammar fixes c. Do the more daring rewrites

import csv
def make_link(url, text):
if not url:
return ' '
return '<a href="%s">%s</a>' % (url, text)
def td(text):
@jml
jml / SuffixArray.hs
Last active December 29, 2015 02:29
Quick and dirty suffix array implementation in Haskell http://en.wikipedia.org/wiki/Suffix_array
import Data.Array (listArray)
import Data.List (sort, tails)
suffixList :: [a] -> [([a], Int)]
suffixList = sort . flip zip [1..] . tails
-- > suffixList "banana"
-- [("",7),("a",6),("ana",4),("anana",2),("banana",1),("na",5),("nana",3)]
listToArray :: [a] -> Array Int a
@jml
jml / coins.hs
Last active December 28, 2015 10:39
-- Two players. Six coins. Start with the coins arranged in a line on the
-- table, alternately heads-up and tails-up, so HTHTHT. One player is heads,
-- one tails. Players alternate moves. Your move is: take any consecutive 1,
-- 2, or 3 coins, and flip them over. So player 1 could decide to flip over
-- coins 2,3 and 4, leaving the line as HHTHHT. You may not flip exactly the
-- same set of coins as the previous player (and so you can't just reverse
-- their move). The goal is to have all the coins showing your side, so if the
-- coins show HHHHHH then the "heads" player wins.