Skip to content

Instantly share code, notes, and snippets.

@christophermark
christophermark / battery_capacities.md
Last active August 29, 2015 14:07
Small Battery Capacity Chart

Battery Capacities

Battery Capacity
CR1632 140 mAh
CR2032 225 mAh
CR2450 620 mAh
CR2477 1000 mAh
AAA 1200 mAh
AA 2500 mAh
@christophermark
christophermark / python_testing_stack.md
Last active August 29, 2015 14:14
A full Python testing stack

So you want to test?

A breakdown of a full Python testing stack

Updated January, 2015
Below is a layer-by-layer breakdown of how I test my Python projects, starting with my Github repository and ending with the test files themselves.

Layer 1: Travis-CI

www.Travis-CI.org

Testing begins with Travis-CI, which hooks into your Github repository to automatically run tests on pull requests and current production branches. It provides a nice visual representation of when tests are failing and a decent overview of all the tests scheduled to run. Travis integration is run through a .travis.yml file in the main project repository. Although Travis is itself a capable test runner, it is important to maintain the ability to run tests locally without having to submit a pull request to test. That's why we'll be using test runners such as tox as described below.

@christophermark
christophermark / private.xml
Last active January 17, 2016 19:04
Karabiner key remapping for waking android screen
<?xml version="1.0"?>
<root>
<!-- Shell Commands -->
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_unlock_android_screen</name>
<url type="shell">
<![CDATA[
~/Library/Android/sdk/platform-tools/adb shell input keyevent 82
]]>
</url>
@christophermark
christophermark / SampleRequest.py
Last active October 6, 2016 22:19
Robin Sample Request (Python)
# This is written for PYTHON 3
# Don't forget to install requests package
import requests
import json
spaceId = 'your space ID here'
apiToken = 'your api token here'
url = 'https://api.robinpowered.com/v1.0/spaces/{}/presence'.format(spaceId)
// List the full gradle dependencies for an Android app
./gradlew app:dependencies -q
@christophermark
christophermark / selectorDebugging.js
Created October 24, 2018 22:43
Selector Debugging
'use strict';
function getDependencies(funcs) {
const dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs
if (!dependencies.every(dep => typeof dep === 'function')) {
const dependencyTypes = dependencies.map(
dep => typeof dep
).join(', ')
throw new Error(
@christophermark
christophermark / eslint_cheatsheet.md
Last active March 25, 2019 14:27
ESLint Cheatsheet

Print ESLint Rules

./node_modules/eslint/bin/eslint.js --print-config .eslintrc.json > rules.json

Show all errors for a specific rule

// todo
@christophermark
christophermark / adbCommand
Created April 29, 2020 18:27
ADB Constant logging debugging into logcat
adb logcat '*:W' > logcatWarningsAndErrors.txt
@christophermark
christophermark / diffs.js
Last active August 22, 2020 13:37
Log the diffs between props in a react component
componentDidUpdate(prevProps) {
console.log("Render update diff:");
const now = Object.entries(this.props);
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined && val !== undefined) return true;
if (prevProps[key] !== val) {
console.log(`${key}
+ ${JSON.stringify(val)}
- ${JSON.stringify(prevProps[key])}`);
@christophermark
christophermark / list_git_files_by_extension
Created October 5, 2020 16:26
List git files by extension
git status | egrep -v '.js|.png'