This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.pacentltd.smartalumni.layoutspec; | |
import com.facebook.drawee.backends.pipeline.Fresco; | |
import com.facebook.drawee.drawable.ScalingUtils; | |
import com.facebook.drawee.generic.RoundingParams; | |
import com.facebook.drawee.interfaces.DraweeController; | |
import com.facebook.imagepipeline.common.ResizeOptions; | |
import com.facebook.imagepipeline.request.ImageRequest; | |
import com.facebook.imagepipeline.request.ImageRequestBuilder; | |
import com.facebook.litho.Column; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ShoppingCart: | |
def __init__(self): | |
self.total = 0 | |
self.items = {} | |
def add_item(self, item_name, quantity, price): | |
self.total += price * quantity | |
self.items.update({item_name: quantity}) | |
def remove_item(self, item_name, quantity, price): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_iso(word): | |
if not type(word) is str: | |
raise TypeError("Argument should be a string") | |
if len(word) == 0: | |
return word, False | |
word = word.lower() | |
for char in word: | |
if word.count(char) > 1: | |
return tuple(word), False | |
return tuple(word), True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"-KXAlZM_-wGb6VtDWaXi" : { | |
"members" : { | |
"93O9tc5SebdZEOtei8tiTN8JQRt2" : 100, | |
"KUwDuuo9zqR0EfAQD5DdGMI3MnS2" : 200, | |
"L9qJXkjvsfRLip5Awg0yhJLcmJb2" : 500 | |
}, | |
"schId" : "-KXAlZMY1cwVaekwtqm2", | |
"schName" : "University of Nigeria Nsukka", | |
"setAdmin" : "KUwDuuo9zqR0EfAQD5DdGMI3MnS2", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void querySet(String memberId) | |
{ | |
Query queryByMember = FirebaseDatabase.getInstance().getReference().child("sets").orderByChild("members/"+memberId).startAt(300); | |
queryByMember.addValueEventListener(new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
//Not that we are returning a list as our query is on sets | |
//so iterate through the datasnapshot and get the values | |
for (DataSnapshot data : dataSnapshot.getChildren()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void querySet(String memberId) | |
{ | |
Query queryByMember = FirebaseDatabase.getInstance().getReference().child("sets").orderByChild("members/"+memberId).endAt(200); | |
queryByMember.addValueEventListener(new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
//Not that we are returning a list as our query is on sets | |
//so iterate through the datasnapshot and get the values | |
for (DataSnapshot data : dataSnapshot.getChildren()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class QuerySetByMembers{ | |
public void querySet(String memberId) | |
{ | |
Query queryByMember = FirebaseDatabase.getInstance().getReference().child("sets").orderByChild("members/"+memberId); | |
queryByMember.addValueEventListener(new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
//Not that we are returning a list as our query is on sets | |
//so iterate through the datasnapshot and get the values | |
for (DataSnapshot data : dataSnapshot.getChildren()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"members" : { | |
"kZDqscQARJVmdYMad9ndJ7X5kmo2" : 100, | |
"kZDqscQARJVmdYMad9ndJ7X5kmo3" : 200, | |
"kZDqscQARJVmdYMad9ndJ7X5kmo4" : 200, | |
"kZDqscQARJVmdYMad9ndJ7X5kmo4" : 100 | |
}, | |
"schoolId" : "-KWJUc2ylvhO02VfVImh", | |
"schoolName" : "University of Nigeria Nsukka ", | |
"setAdmin" : "kZDqscQARJVmdYMad9ndJ7X5kmo2", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirebaseQuery { | |
//Build a key value Pair | |
public Map<String, Object> getKeyValuePair(){ | |
Object obj = new Object(); | |
Map<String, Object> keyValuePair = new HashMap<>(); | |
keyValuePair.put("key1","This is a string value"); //a string value | |
keyValuePair.put("key2",12); //an integer value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Key2" : "Value2", | |
"key1" : 12, | |
"key3" : 12.09, | |
"key4" : 198376475886432 | |
} |