Skip to content

Instantly share code, notes, and snippets.

View solominh's full-sized avatar

Minh Tran solominh

View GitHub Profile
@solominh
solominh / react-firebase-auth.js
Created March 25, 2017 00:10 — forked from nateinaction/react-firebase-auth.js
This is a version of Facebook's React Conditional Rendering example modified to support firebase authentication.
/*
* This is a version of Facebook's React Conditional Rendering
* example modified to support firebase authentication.
* https://facebook.github.io/react/docs/conditional-rendering.html
*/
import React, { Component, PropTypes } from 'react';
import * as firebase from 'firebase';
function UserAvatar(props) {
@solominh
solominh / monad-stream-example.js
Created January 24, 2017 19:26 — forked from mpj/monad-stream-example.js
This is the code from Monads - episode #21 of FunFunFunction (https://www.youtube.com/playlist?list=PL0zVEGEvSaeFSwPn06GKArptSxiP1Gff8)
const fetch = require('node-fetch')
const Bacon = require('baconjs')
function getInPortuguese(word) {
// Google Translate API is a paid (but dirt cheap) service. This is my key
// and will be disabled by the time the video is out. To generate your own,
// go here: https://cloud.google.com/translate/v2/getting_started
const apiKey =
'AIzaSyB4DyRHIsNhogQXmH16YKbZfR-lTXrQpq0'
const url =
@solominh
solominh / MediaPlayer-excerpt.java
Created March 23, 2016 05:23 — forked from jonjensen/MediaPlayer-excerpt.java
simplified example of Android sound player
/**
* Convenience method to create a MediaPlayer for a given resource id.
* On success, {@link #prepare()} will already have been called and must not be called again.
* <p>When done with the MediaPlayer, you should call {@link #release()},
* to free the resources. If not released, too many MediaPlayer instances will
* result in an exception.</p>
*
* @param context the Context to use
* @param resid the raw resource id (<var>R.raw.&lt;something></var>) for
* the resource to use as the datasource
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>