Skip to content

Instantly share code, notes, and snippets.

@afternoon2
afternoon2 / polygonBooleanOps.js
Last active January 4, 2024 21:33
Polygon boolean operations using clipper.js for pen plotting purposes
// this is an old version available on npm and jsdelivr, but you can download
// newer version here: https://sourceforge.net/projects/jsclipper/files/ and keep it
// locally in your project
import ClipperLib from "https://cdn.jsdelivr.net/npm/js-clipper@1.0.1/+esm";
const SUBJECT = ClipperLib.PolyType.ptSubject; // 0
const CLIP = ClipperLib.PolyType.ptClip; // 1
const FILL_NON_ZERO = ClipperLib.PolyFillType.pftNonZero;
const FILL_EVEN_ODD = ClipperLib.PolyFillType.pftEvenOdd;
const DIFFERENCE = ClipperLib.ClipType.ctDifference;
@camillebaldock
camillebaldock / oyster.rb
Last active February 4, 2017 13:43
Oyster journey history scraping script
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
require 'awesome_print'
Capybara.run_server = false
Capybara.current_driver = :poltergeist
class Oyster

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)