Skip to content

Instantly share code, notes, and snippets.

@axelson
axelson / firmware_reload.ex
Created July 9, 2019 18:55 — forked from cblavier/firmware_reload.ex
Elixir nerves to upload firmware / reload code
defmodule Mix.Tasks.MyNervesProject.Firmware.Reload do
use Mix.Task
@app_name Mix.Project.config[:app]
@cookie_file "rel/vm.args"
@mdns_domain Application.get_env(:nerves_init_gadget, :mdns_domain)
@node_name Application.get_env(:nerves_init_gadget, :node_name)
def run(_) do
@axelson
axelson / base_calculator.ex
Last active May 7, 2019 03:53 — forked from sgyyz/base_calculator.ex
Elixir Abstract and Extends
defmodule BaseCalculator do
@moduledoc """
Define the base calculator and provide public API.
Define the callback to implement specific logic in child module.
"""
# it should be implemented by child module
@callback do_calculate(num1 :: integer, num2 :: integer) :: {:ok, integer} | {:error, any()}
def calculate(module, num1, num2) do
@axelson
axelson / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
Honolulu Buses Over Time

This simple bar chart shows the amount of buses operating in Oahu over time. As we can see the number of buses serving Oahu has not changed much since bus service was first introduced. While this is not a comprehensive analysis it would appear that the level of service for TheBus has gone down or at least not increased over time since area that TheBus serves has only increased. It would be nice to do an analysis that would include historical coverage areas and bus routes.

One way to increase bus service quality without an increase in funding is by increasing frequency on core routes, hopefully getting some routes to every 10

@axelson
axelson / README.md
Last active August 29, 2015 14:20 — forked from wpoely86/README.md

Diverging Stacked Bar Chart

We create a diverging stacked bar chart to plot a 5 point Likert scale. There a lots of ways to plot a Likert scale but according to Robbins & Heiberger, a diverging stacked bar chart is the best and I agree.

I've used D3.js. There is also an R package by Robbins & Heiberger.

The original can be found at github

/*
* BarTab integration - Vimperator Plugin
*
* Commands:
* :tap tap the current tab
* :tap # tap the previous seleced tab
* :tap {num}:? tap the {num}-th tab
* :tap! tap all tabs without the current tab
*
* Tab Completion is available !!