Skip to content

Instantly share code, notes, and snippets.

@udacityandroid
udacityandroid / onCreate method in MainActivity.java
Created May 13, 2016 18:17
Use OnClickListeners for All Categories - onCreate method in MainActivity.java
// Find the View that shows the numbers category
TextView numbers = (TextView) findViewById(R.id.numbers);
// Set a click listener on that View
numbers.setOnClickListener(new View.OnClickListener() {
// The code in this method will be executed when the numbers View is clicked on.
@Override
public void onClick(View view) {
Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class);
startActivity(numbersIntent);
@udacityandroid
udacityandroid / firebase-data.json
Created January 26, 2016 08:47
Firebase - Lesson 5 - Rules and Datastructure for Account Merge Example
{
"acknowledge" : {
"merges" : {
"accepted" : {
"898dac5d-f99d-463a-b82a-54abd5784447" : "google:106385094246122969144"
},
"proposed" : {
"898dac5d-f99d-463a-b82a-54abd5784447" : "google:106385094246122969144"
}
},
@udacityandroid
udacityandroid / acknowledge.js
Created January 26, 2016 08:32
Firebase - Lesson 5 - Javascript for Account Merge Example
var ref = new Firebase('https://yours.firebaseio.com/acknowledge');
var users = [];
function $(selector) {
var result = document.querySelectorAll(selector);
return (result.length > 1) ? Array.prototype.slice.call(result) : result[0];
}
function handleAuthResult(error, authData) {
if (error) {
@udacityandroid
udacityandroid / rules.bolt
Created January 20, 2016 21:25
Firebase - Lesson 5 - Example Bolt File
/** NOTE: This is just an example file for what Bolt code looks like. The rules.json file does not
mirror the output of this file **/
// Objects for ShoppingList++
type User {
name : String,
email : EncodedEmail,
timestampJoined : Timestamp,
hasLoggedInWithPassword : Boolean
}
@udacityandroid
udacityandroid / rules.json
Created January 20, 2016 20:14
Firebase - Lesson 5 - Example Validations
{
"rules": {
".read" : "true",
".write" : "true",
"userFriends": {
"$userEncodedEmail": {
"$friendEncodedEmail": {
".validate": "newData.hasChildren(['name', 'email', 'timestampJoined', 'hasLoggedInWithPassword'])",
"name": {
@udacityandroid
udacityandroid / shoppinglistplusplus.json
Created December 23, 2015 23:52
Firebase - Lesson 4 - Many to Many : Option E
{
"users" : {
"americanguyw1521@gmail,com" : {
"email" : "americanguyw1521@gmail,com",
"hasLoggedInWithPassword" : true,
"name" : "Walter Latimer",
"timestampJoined" : {
"timestamp" : 1447801255394
}
},
@udacityandroid
udacityandroid / shoppinglistplusplus.json
Created December 23, 2015 23:51
Firebase - Lesson 4 - Many to Many : Option D
{
"users" : {
"americanguyw1521@gmail,com" : {
"email" : "americanguyw1521@gmail,com",
"hasLoggedInWithPassword" : true,
"name" : "Walter Latimer",
"timestampJoined" : {
"timestamp" : 1447801255394
},
"userLists" : {
@udacityandroid
udacityandroid / shoppinglistplusplus.json
Created December 23, 2015 23:51
Firebase - Lesson 4 - Many to Many : Option C
{
"users" : {
"americanguyw1521@gmail,com" : {
"email" : "americanguyw1521@gmail,com",
"hasLoggedInWithPassword" : true,
"name" : "Walter Latimer",
"timestampJoined" : {
"timestamp" : 1447801255394
}
},
@udacityandroid
udacityandroid / shoppinglistplusplus.json
Created December 23, 2015 23:50
Firebase - Lesson 4 - Many to Many : Option B
{
"users" : {
"americanguyw1521@gmail,com" : {
"email" : "americanguyw1521@gmail,com",
"hasLoggedInWithPassword" : true,
"name" : "Walter Latimer",
"timestampJoined" : {
"timestamp" : 1447801255394
}
},
@udacityandroid
udacityandroid / shoppinglistplusplus.json
Created December 23, 2015 23:49
Firebase - Lesson 4 - Many to Many : Option A
{
"users" : {
"americanguyw1521@gmail,com" : {
"email" : "americanguyw1521@gmail,com",
"hasLoggedInWithPassword" : true,
"name" : "Walter Latimer",
"timestampJoined" : {
"timestamp" : 1447801255394
},
"userLists" : {