This file contains hidden or 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
apply plugin: 'android-library' | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.9.+' | |
} |
This file contains hidden or 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
function color_my_prompt { | |
local __user_and_host="\[\033[01;32m\]\u@\h" | |
local __cur_location="\[\033[01;34m\]\w" | |
local __git_branch_color="\[\033[31m\]" | |
#local __git_branch="\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`" | |
local __git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`' | |
local __prompt_tail="\[\033[35m\]$" | |
local __last_color="\[\033[00m\]" | |
export PS1="$__user_and_host $__cur_location $__git_branch_color$__git_branch$__prompt_tail$__last_color " | |
} |
This file contains hidden or 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 PrintDemo { | |
private int i; | |
public void printCount() { | |
try { | |
for (i = 5; i > 0; i--) { | |
System.out.println("Selected number is: " + i ); | |
} | |
} catch (Exception e) { | |
System.out.println("Thread has been interrupted."); |
This file contains hidden or 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 PrintDemo { | |
public void printCount() { | |
try { | |
for (int i = 5; i > 0; i--) { | |
System.out.println("Selected number is: " + i ); | |
} | |
} catch (Exception e) { | |
System.out.println("Thread has been interrupted."); | |
} | |
} |
This file contains hidden or 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 final class Star { | |
/** | |
* Final and private attributes | |
*/ | |
private final double mass; | |
private final String name; | |
private final Date fDateOfDiscovery; | |
public Planet (double aMass, String aName, Date aDateOfDiscovery) { |
This file contains hidden or 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 final class Star { | |
/** | |
* Final and private attributes | |
*/ | |
private final double mass; | |
private final String name; | |
private final Date dateOfDiscovery; | |
public Star (double aMass, String aName, Date aDateOfDiscovery) { |
This file contains hidden or 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
FirebaseDatabase database = FirebaseDatabase.getInstance(); | |
DatabaseReference myRef = database.getReference("message"); | |
myRef.setValue("Hello, World!"); |
This file contains hidden or 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
FirebaseDatabase database = FirebaseDatabase.getInstance(); | |
database.getReference().push().setValue("Hello world"); |
This file contains hidden or 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
FirebaseDatabase database = FirebaseDatabase.getInstance(); | |
DatabaseReference myRef = database.getReference("message"); | |
myRef.addValueEventListener(new ValueEventListener() { | |
@Override | |
public void onDataChange(DataSnapshot dataSnapshot) { | |
Log.i("MyApp","Data changed"); | |
} | |
@Override | |
public void onCancelled(DatabaseError databaseError) { |
This file contains hidden or 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
private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { | |
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); | |
Cipher cipher = Cipher.getInstance("AES"); | |
cipher.init(Cipher.ENCRYPT_MODE, skeySpec); | |
byte[] encrypted = cipher.doFinal(clear); | |
return encrypted; | |
} | |
private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { | |
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); |
OlderNewer