Skip to content

Instantly share code, notes, and snippets.

View kaosat-dev's full-sized avatar

Mark Moissette kaosat-dev

View GitHub Profile
@Evangenieur
Evangenieur / cs-component.html
Last active December 18, 2015 07:00
Polymer Project with inline CoffeeScript component
<element name="cs-component">
<template>
I am a {{ language }} component
</template>
<script type="text/coffeescript">
Polymer.register @,
language: "CoffeeScript"
ready: ->
console.log "READY", @
</script>
@benjyhirsch
benjyhirsch / 0-description.md
Last active February 4, 2016 22:00
Inspired by Cycle.js and Motorcycle.js

I was playing around with functional and reactive programming in Javascript, and the UI framework Cycle.js. In order to better understand how that framework works, I pared down the core functionality to a single concept: given a function that takes in an input stream and returns an output stream, resolve the circular dependency of feeding its output back into itself as input. I also built a naive re-implementation of the core Cycle.run command on top of that.

@mozz100
mozz100 / xbee.js
Last active April 16, 2016 21:48
Node.js, xbee and promises
var SerialPort = require('serialport').SerialPort;
var xbee_api = require('xbee-api');
var C = xbee_api.constants;
var Q = require('q');
// following settings work for me on my Raspberry pi, your config may differ!
var xbeeAPI = new xbee_api.XBeeAPI({
api_mode: 1
});
var serialport = new SerialPort("/dev/ttyAMA0", {
@jonatw
jonatw / install_opencv_debian.sh
Last active September 1, 2016 04:58
install opencv on debian, tested on raspberry pi (debian wheezy)it takes "long time" for compiling opencv library. please be patient.Reference: http://opencv.willowgarage.com/wiki/InstallGuide_Linux
#install esseintal packages for opencv
apt-get -y install build-essential
apt-get -y install cmake
apt-get -y install pkg-config
apt-get -y install libgtk2.0-dev libgtk2.0
apt-get -y install zlib1g-dev
apt-get -y install libpng-dev
apt-get -y install libjpeg-dev
apt-get -y install libtiff-dev
apt-get -y install libjasper-dev
@tlrobinson
tlrobinson / boilerplate.es6
Created March 4, 2015 20:03
node-webworker-threads + workerstream + browserify + babel
import ParentStream from "workerstream/parent";
global.stream = ParentStream();
@axefrog
axefrog / limitFlow.js
Last active October 17, 2016 19:44
Flow control limiter for most.js. Unlike `throttle`, which drops events indiscriminately, `limitFlow` retains the most recent event and ensures that it is emitted when the specified period elapses.
// Limit the rate of flow to an event every 250ms:
// const stream$ = other$.thru(limitFlow(250));
export function limitFlow(period) {
return function limitFlow(stream) {
const source = new RateLimitSource(stream.source, period);
return new stream.constructor(source);
};
}
@foosel
foosel / README.md
Last active January 24, 2017 20:14
First experiments with NodeMCU to publish the current settings of my adjustable height working desk to MQTT

First experiments with NodeMCU to publish the current settings of my adjustable height working desk to MQTT.

NodeMCU can be found here: https://github.com/nodemcu/nodemcu-firmware

Note that you'll need a current version with support for floats (which the ultrasonic sensor library utilizes), I'm using 0.9.5 2015-03-18 with float support myself.

Support for the HC-SR04 sensor in NodeMCU can be found here: https://github.com/sza2/node_hcsr04

I provided my slightly adjusted version which makes measuring a non-blocking afair, allowing for callbacks when the measurement completes.

@wegry
wegry / commonjs-to-es6-modules.js
Last active July 20, 2017 04:12
purescript psc 0.9 output webpack loader that allows tree shaking
"use strict"
/*
* Webpack 2 loader that can take CommonJS output by psc 0.9.1 and convert
* it into tree shakable ES6 modules. No transpiling required.
*/
const fs = require('fs')
const commonJsRequire = /var ([$\w]+) = require\("(.*)"\)/g
const moduleExports = /module\.exports = \{(\n( ([$\w]+): ([$\w]+)(, )?\n)*)?\};/m
@lamberta
lamberta / extract-meta.sh
Created March 5, 2012 05:30
Parse metadata variables from a markdown file.
#!/usr/bin/env bash
##
## Parse metadata variables from a markdown file.
##
## The key-values are returned as field-deliminated lines to
## stdout, or, as a variable string that can be passed to pandoc
## as command-line parameters.
##
## Delcare metadata in the markdown file using the format:
## % meta keyname1="value1"
@maxpert
maxpert / results.txt
Created July 15, 2012 12:24
JSON vs MsgPack using Gzip + LZ4
Original tweet size in JSON 2624 Msgpack = 1817 Gzip + Json = 1058 Gzip + Msgpack = 1116 LZ4 + Json = 1628 LZ4 + Msgpack = 1361
Original tweet size in JSON 1863 Msgpack = 1443 Gzip + Json = 0783 Gzip + Msgpack = 0835 LZ4 + Json = 1153 LZ4 + Msgpack = 1040
Original tweet size in JSON 2074 Msgpack = 1670 Gzip + Json = 0842 Gzip + Msgpack = 0894 LZ4 + Json = 1229 LZ4 + Msgpack = 1139
Original tweet size in JSON 2025 Msgpack = 1617 Gzip + Json = 0845 Gzip + Msgpack = 0895 LZ4 + Json = 1238 LZ4 + Msgpack = 1143
Original tweet size in JSON 2069 Msgpack = 1663 Gzip + Json = 0846 Gzip + Msgpack = 0901 LZ4 + Json = 1243 LZ4 + Msgpack = 1164
Original tweet size in JSON 2035 Msgpack = 1634 Gzip + Json = 0852 Gzip + Msgpack = 0907 LZ4 + Json = 1247 LZ4 + Msgpack = 1167
Original tweet size in JSON 1988 Msgpack = 1464 Gzip + Json = 0804 Gzip + Msgpack = 0862 LZ4 + Json = 1220 LZ4 + Msgpack = 1061
Original tweet size in JSON 1910 Msgpack = 1502 Gzip + Json = 0775 Gzip + Msgpack = 0832 LZ4 + Json = 1154 LZ4 + Msgpack = 1060