Skip to content

Instantly share code, notes, and snippets.

@joscha
joscha / keybase.md
Created March 8, 2017 13:39
keybase.md

Keybase proof

I hereby claim:

  • I am joscha on github.
  • I am joschafeth (https://keybase.io/joschafeth) on keybase.
  • I have a public key ASBr-R6CvnZZEb1ct1FnwTONSz_cvGN5N5VRQxazxktrSwo

To claim this, I am signing this object:

@joscha
joscha / README.md
Created February 1, 2017 14:31
Lerna folder example

Run:

cd project
npm install
`npm bin`/lerna bootstrap
const es2015preset = require('babel-preset-es2015');
const commonjsPlugin = require('babel-plugin-transform-es2015-modules-commonjs');
es2015preset.plugins.forEach(function(plugin) {
if (plugin.length && plugin[0] === commonjsPlugin) {
plugin[1].strict = false;
}
});
module.exports = es2015preset;
@joscha
joscha / README.md
Last active September 18, 2016 12:25
SodaqOne PlatformIO config
@joscha
joscha / MonitoredStory.js
Last active May 2, 2019 21:23
React Storybook example for stats.js integration
import React from 'react';
import Stats from 'stats.js';
const { requestAnimationFrame, cancelAnimationFrame } = window;
class MonitoredStory extends React.Component {
constructor(...args) {
super(...args);
this.rafFn = () => null; // noop
}
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
// LoRaWAN NwkSKey, network session key
// This is the default Semtech key, which is used by the prototype TTN
// network initially.
static const PROGMEM u1_t NWKSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };
// LoRaWAN AppSKey, application session key
@joscha
joscha / DS1307.cpp
Last active May 14, 2016 06:38 — forked from technobly/sparkDS1307.cpp
RTC DS1307 LIBRARY FOR SPARK CORE
#include "application.h"
#include "DS1307.h"
const uint8_t daysInMonth[13] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
// number of days since 2000/01/01, valid for 2001..2099
static uint16_t date2days(uint16_t y, uint8_t m, uint8_t d) {
if (y >= 2000)
@joscha
joscha / README.md
Created January 1, 2016 06:08
Automated bisect for node projects

Script to run an automated git bisect in a node project.

This script assumes a standard location of node_modules and a defined test script.

$ git bisect bad # mark current revision as bad
$ git bisect good origin/master # mark origin/master as good
$ git bisect run ./test.sh # run automated bisection
$ git bisect reset # reset the bisect
// file X depending on EventEmitter
var EventEmitter = __webpack_require__(16);
// EventEmitter module
/***/ },
/* 16 */
/***/ function(module, exports, __webpack_require__) { ...
module.exports = EventEmitter;
function prettifySpreadsheetJSON(data) {
var prefix = 'gsx$';
for (var i = 0; i < data.feed.entry.length; i++) {
for (var key in data.feed.entry[i]) {
if (data.feed.entry[i].hasOwnProperty(key) && key.substr(0,prefix.length) === prefix) {
data.feed.entry[i][key.substr(prefix.length)] = data.feed.entry[i][key].$t;
delete data.feed.entry[i][key];
}
}
}