Skip to content

Instantly share code, notes, and snippets.

View mheiber's full-sized avatar

Max Heiber mheiber

View GitHub Profile
@mheiber
mheiber / xmlNamespaceConvert.py
Last active January 2, 2016 09:39
EPUB namespace converted for Google Play. This program changes the namespace format for XHTML files so EPUBs will validate with the Google Play store. Python's ElementTree module for XML parsing changes the namespace format to something Google Play doesn't like.
'''
xmlNamespaceConvert.py
Language: Python 2.7
This program changes the namespace format for XHTML files so EPUBs will
validate with the Google Play store. One use for this is if you edit EPUBs
using Python's elementTree module, which messes with namespaces.
This program changes the format from: '<html:[tag]>' to simply <tag> and makes the appropriate change
to the namespace declaratio.n
@mheiber
mheiber / README.md
Created April 23, 2014 23:56 — forked from mbostock/.block

This pie chart is constructed from a CSV file storing the populations of various age groups. The chart employs a number of D3 features:

@mheiber
mheiber / designer.html
Created August 14, 2014 00:57
designer
<link rel="import" href="../paper-checkbox/paper-checkbox.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
@mheiber
mheiber / Tabset.html
Last active August 29, 2015 14:17
Minimalist TabSet component for React
<!--
Try on Plunker: http://plnkr.co/edit/68KIqXLWBkqYA6wiwg2H?p=preview
Try on bl.ocks: http://bl.ocks.org/mheiber/93046fa59e04c0cdf57a
-->
<script src='http://fb.me/react-0.12.2.js'></script>
<script src='http://fb.me/JSXTransformer-0.12.2.js'></script>
<script src="https://cdn.polyfill.io/v1/polyfill.min.js"></script>
<script type="text/jsx">
var TabSet=React.createClass({
@mheiber
mheiber / Database.py
Created September 19, 2015 23:09
connect to a database, execute multiple queries from a single string of SQL statements, get results as a list of ordered dictionaries
'''Python 2.7X and Python 3X'''
import sqlite3
import sys
import unittest
from collections import OrderedDict
class Database():
@mheiber
mheiber / app.js
Created January 7, 2016 02:38
Memoizing React stateless function components
import React from 'react';
import {render} from 'react-dom';
import memoize from 'memoization';
const Foo = ({number}) => {
console.log(`Rendering with number= ${number}`);
return <div>{number}</div>
};
// `memoize` caches the return value of a function.

Symbols

What

  • Like strings or UIDs, but guaranteed to be unique
  • (almost) private
  • low usefulness-to-comprehensibility ratio

Symbols have nothing to do with Ruby symbols (:ruby_symbol)

Symbols

What

  • Like strings or UIDs, but guaranteed to be unique
  • (almost) private

Symbols have nothing to do with Ruby symbols (:ruby_symbol)

How

@mheiber
mheiber / symbol.md
Last active February 19, 2016 01:09

Symbols

What

  • Like strings or UIDs, but guaranteed to be unique
  • (almost) private
  • low usefulness-to-comprehensibility ratio

Symbols have nothing to do with Ruby symbols (:ruby_symbol)

const list = [1, 2]
list.push(3)
console.log(list) // [1, 2, 3]