Skip to content

Instantly share code, notes, and snippets.

View tyrchen's full-sized avatar

Tyr Chen tyrchen

View GitHub Profile
@tyrchen
tyrchen / rxjs-react.js
Created September 29, 2015 23:33 — forked from nicolashery/rxjs-react.js
Fetching data asynchronously with RxJS and React
import React from 'react';
import _ from 'lodash';
import Rx from 'rx';
import superagent from 'superagent';
let api = {
host: 'http//localhost:3001',
getData(query, cb) {
superagent
@tyrchen
tyrchen / introrx.md
Last active September 7, 2015 00:23 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

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.

@tyrchen
tyrchen / rethinkdb.md
Last active September 2, 2015 22:25 — forked from mblair/rethinkdb.md
An Operator's Look at RethinkDB

An Operator's Look at RethinkDB

Matt Blair - @mattyblair - Flipboard

The Getting Started Experience

  • It's in Homebrew and just runs (relative to, say, HBase): awesome!
  • Having packages for popular Linux distros (I use Ubuntu personally and at work): awesome!
  • Serving the GPG key over HTTP: not so awesome :-/
  • apt-get -y install rethinkdb
  • It didn't start by default- great! I hate when services do this. I then looked at the start script to see how it knew (usually daemons use /etc/default/blah, but it has custom logic to see if there's anything in /etc/rethinkdb/instances.d, which is cool).
@tyrchen
tyrchen / README.md
Last active August 29, 2015 15:31 — forked from denji/README.md
Remove WebStorm; PhpStorm; PyCharm; RubyMine; AppCode; CLion, IntelliJ; 0xDBE10 settings and cli-links from Mac OSX

Quick uninstall JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
#!/bin/bash
usage ()
{
cat <<UsageHERE
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT
or boot2docker-fwd -d RULE_NAME
or boot2docker-fwd -l
or boot2docker-fwd -A
ssh ubuntu@n.n.n.n "bash -s -x" -- <ixgbevf-upgrade.sh

Untitled Slide

Welcome to Glide.

Glide is the easiest way to create useful slide for all of your Gists.

  • input key <- to go backward.
  • input key -> to go forward.

Publishing

#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
// Set up a collection to contain player information. On the server,
// it is backed by a MongoDB collection named "players".
Players = new Meteor.Collection("players");
if (Meteor.isClient) {
Template.leaderboard.players = function () {
return Players.find({}, {sort: {score: -1, name: 1}});
};
Template.leaderboard.selected_name = function () {
var player = Players.findOne(Session.get("selected_player"));
return player && player.name;