Skip to content

Instantly share code, notes, and snippets.

@xgrommx
xgrommx / rxandroid-tuts.md
Last active August 28, 2015 19:51 — forked from plastiv/rxandroid-tuts.md
Links for android developers
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>
Lazy Loading Images With AngularJS
</title>
<style type="text/css">
/**
* Decorator to add 'transform' and 'transformError' methods to promises.
* These can manipulate the result without catching errors so the 'then'
* functions will still work as expected.
*/
$provide.decorator('$q', function($delegate) {
var defer = $delegate.defer;
$delegate.defer = function() {
var deferred = defer();
deferred.promise.transform = function(fn) {
@xgrommx
xgrommx / pso.js
Created February 25, 2014 09:23 — forked from adrianseeley/pso.js
// based on http://msdn.microsoft.com/en-us/magazine/hh335067.aspx
// usage example at bottom
function pso (number_of_dimensions, function_to_optimize, number_of_particles, number_of_iterations, fitness_threshold, inertia_weight, cognitive_weight, social_weight) {
var particles = [];
var swarm_best_position = [];
var swarm_best_fitness = null;
for (var p = 0; p < number_of_particles; p++) {
particles.push({
particle_position: [],
{
"structure": {
"copy": [
{
"from": "/Users/eric/Code/Shared/wardrobe/core/bower.json",
"to": "bower.json"
},
{
"from": "/Users/eric/Code/Shared/wardrobe/core/package.json",
"to": "package.json"
// Bootstrap is used for visual effects
/*
HTML
<ng-upload ng-model="file"></ng-upload>
<ng-upload ng-model="Object.file"></ng-upload>
*/
var directives = {
ngUpload: function () {
/** @jsx React.DOM */
'use strict';
var React = require('react');
var AnimatableComponent = React.createClass({
propTypes: {
tag: React.PropTypes.component.isRequired,

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.

import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import com.cybozu.labs.langdetect.Detector;
import com.cybozu.labs.langdetect.DetectorFactory;
import com.cybozu.labs.langdetect.LangDetectException;
import com.twitter.hbc.ClientBuilder;
import com.twitter.hbc.core.Client;
import com.twitter.hbc.core.Constants;