Skip to content

Instantly share code, notes, and snippets.

@cpbotha
cpbotha / README.md
Last active May 13, 2020 12:23
Simple example of reusable d3 plugin.

This as-simple-as-possible example tries to demonstrate Mike Bostock's pattern "Towards Reusable Charts" http://bost.ocks.org/mike/chart/ for d3 plugins that are composite shapes.

@cpbotha
cpbotha / dropshadow.js
Last active September 19, 2023 15:43
d3.js drop shadow example
// d3.js drop shadow example
// put together by http://charlbotha.com/
var items = [
{x : 50, y : 10},
{x : 100, y: 170},
{x : 320, y: 70}
];
// we can increase this, everything will scale up with us
@cpbotha
cpbotha / README.md
Last active January 10, 2017 00:49
d3.js breathing drop shadows

Look ma, those drop shadows are breathing!

Your eyes want you to believe that the blocks are hovering up and down, when in fact only the drop shadow is being translated out and in again.

Follow me on https://twitter.com/cpbotha for even more fun, or see my other d3 blocks: http://bl.ocks.org/cpbotha

@cpbotha
cpbotha / horizontal_stacked_bar_chart.ipynb
Last active December 18, 2015 22:09
horizontal stacked bar chart
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cpbotha
cpbotha / colorbrewer_interpolate.js
Last active September 27, 2016 04:56
ColorBrewer sequential single hue scales vs. d3 interpolators.
// comparison of different d3 colour interpolators with
// colorbrewer sequential single-hue scales
//
// -- http://twitter.com/cpbotha
var numC = 9;
var data = d3.range(numC);
var showColourInterpolations = function(name, cbMap) {
var rectHeight = 50,
@cpbotha
cpbotha / pyside_dynamic.py
Last active January 17, 2024 05:39
pyside_dynamic.py with minor improvements - also see http://stackoverflow.com/a/14894550/532513
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Sebastian Wiesner <lunaryorn@gmail.com>
# Modifications by Charl Botha <cpbotha@vxlabs.com>
# * customWidgets support (registerCustomWidget() causes segfault in
# pyside 1.1.2 on Ubuntu 12.04 x86_64)
# * workingDirectory support in loadUi
# found this here:
# https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py

Keybase proof

I hereby claim:

  • I am cpbotha on github.
  • I am cpbotha (https://keybase.io/cpbotha) on keybase.
  • I have a public key ASDREmSD8t6oJihr4EnEG1-26vjV9QtcKZ8EFy0H5bsffAo

To claim this, I am signing this object:

;; cpbotha's not so nice elpy init
(use-package elpy
:commands (elpy-enable) ;; this will ensure lazy loading
:config
(progn
(message "LAZY loading elpy")
(elpy-enable)
;; elpy is mightily confused by ipython 5.2 so we disable it
;; (elpy-use-ipython)
// what we would like to see: first LED then second LED lights up on the WS2812 strip
// what we see instead: first LED (indicates startup), but then first 4 LEDs go on together, meaning xbee never talked back
// with SoftwareSerial(2,3) and the SparkFun shield switched to dline (vs UART), it does work.
#include <FastLED.h>
#include <XBee.h>
#include <Printers.h>
#define DATA_PIN 9
/**
* Running this sketch on the RobotDyn Arduino M0 (SAMD21) with the itead xbee shield 1.1 I see the following output:
*
* waiting for any serial data to become available from the xbee
* 2795 MODEM_STATUS_RESPONSE: 0
* waiting for any serial data to become available from the xbee
* No packet available.
* waiting for any serial data to become available from the xbee
* 7974 MODEM_STATUS_RESPONSE: 0
*