Skip to content

Instantly share code, notes, and snippets.

View roblight's full-sized avatar

Rob Light roblight

View GitHub Profile
@roblight
roblight / streamtest.js
Created September 23, 2019 14:16 — forked from dirkvm/streamtest.js
websocket based streaming for Tesla
const util = require('util');
const WebSocket = require('ws');
const vehicle_id = ''; // as returned by the /vehicles api call
const token = ''; // tokens[0] as returned by the /vehicles api call
const email = ''; // login e-mail
const stream_columns = [
'speed',
'odometer',
@roblight
roblight / sequelize-schema-file-generator.js
Created February 2, 2018 19:43 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
import * as models from "models";
import Sequelize from "sequelize";
import fs from "fs";
delete models.default;
const sequelize = new Sequelize(
'',
'',
'', {
@roblight
roblight / sequelize-migration-file-generator.js
Created February 2, 2018 19:43 — forked from manuelbieh/sequelize-migration-file-generator.js
Creates migration files for existing sequelize models
import * as models from "models";
import fs from "fs";
for(let model in models) {
let attributes = models[model].attributes;
for(let column in attributes) {
delete attributes[column].Model;
delete attributes[column].fieldName;
const { DataTypes } = require('sequelize')
module.exports = {
schema: {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
allowNull: false,
autoIncrement: true,
},
@roblight
roblight / java-signals-test.sh
Created January 26, 2016 12:28 — forked from nicoulaj/java-signals-test.sh
What signals can your JRE handle ?
#!/bin/bash
# Get temp dir
tmpdir=$(mktemp -d)
# Generate test
cat > ${tmpdir}/ListenToSignal.java <<EOF
import sun.misc.Signal;
import sun.misc.SignalHandler;
public class ListenToSignal {
@roblight
roblight / index.ts
Last active September 17, 2015 15:53 — forked from davideast/index.ts
Simple Angular 2 Forms with Firebase
import {bootstrap, Component, Decorator, View, If, For, EventEmitter} from 'angular2/angular2';
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
@Component({
selector: 'app',
injectables: [FormBuilder]
})
@View({
template: `
<div class="container" [control-group]="myForm">
#!/bin/sh
### Run this script via a cronjob every (every minute or so) on a server that has access to your dropbox.
### You must install youtube-dl (http://rg3.github.com/youtube-dl/) for this to work.
queue_files_dir=~/Dropbox/IFTTT/youtube-dl
queue_files="$queue_files_dir"/*.txt
output_dir=/Volumes/Internal\ HD/Files/Videos/YouTube
shopt -s nullglob
@roblight
roblight / scrapple.py
Last active August 29, 2015 14:06 — forked from jhofman/scrapple.py
#!/usr/bin/env python
#
# file: scrapple.py
#
# description: checks apple.come for iphone 5s in-store pickup availability
#
# usage: ./scrapple.py [zip] [att|verizon|sprint] [16|32|64] [grey|silver|gold]
#
# or in a crontab:
# */5 * * * * /path/to/scrapple.py 10012 verizon 32 grey && mailx -s 5s 2125551212@vtext.com

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

var arr = [1,1,2];
var arr = arr.filter(function (v, i, a) { return a.indexOf (v) == i }); // dedupe array