Skip to content

Instantly share code, notes, and snippets.

@omatt
omatt / TropoDataStorage
Last active December 16, 2015 04:29
Tropo Sample storing online accounts user data.
var askAccount = ask("What's the online account details that you want to know?You can select Facebook or Twiiter", {
choices: "facebook, twitter, github",
timeout: 20.0,
attempts: 3,
onBadChoice: function(askAccount) {
say("I'm sorry, I didn't understand that. You can select facebook or twitter.");
},
onChoice: function(askAccount) {
if(askAccount.value == "facebook"){
say("Your username is sample@facebook.com");
@omatt
omatt / EncapsulationSample
Created September 19, 2013 06:40
Simple implementation of the Object Oriented Concept - Encapsulation
/**
* Sample for Object Oriented Programming Concepts
*
* Encapsulation
*
* @author Reyes, Omar Matthew B.
* @version 2013/09/07
*/
public class EncapsulationSample{
@omatt
omatt / BufferedReader
Created September 22, 2013 09:53
Data readers
/** Java BufferedReader **/
import java.io.*;
// initialize class
{
public static void main(String [] args)throws IOException{
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String inputString = buffer.readLine();
int inputInt = Integer.parseInt(buffer.readLine());
@omatt
omatt / Colors
Created September 22, 2013 14:25
Set colors in Java using hex color codes. Generate hex color codes in here - http://hexcolorgenerator.com/
Color colorA = new Color(0xFF0096); // Use the hex number syntax
Color bColor = Color.decode("0xFF0096"); // or with the use of decode
object.setColor(Color.white);
setBackground(Color.white);
/** Alternatively using hex color codes to expand the color library **/
object.setColor(new Color(0xFF0096));
object.setColor(Color.decode("0xFF0096"));
@omatt
omatt / InputPHP
Last active December 23, 2015 16:09
Sample PHP code that accepts input and redirecting to another page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title>Seatwork</title>
<script type="text/javascript">
function valForm(){
if(document.myForm.firstName.value==""){
if(document.myForm.firstName.value==""){
document.getElementById("fName").innerHTML = "this is required";
}
@omatt
omatt / GitBashCommands
Last active November 28, 2022 18:34
Git Bash console helpful commands.
$ git config --global user.name <Name Here>
$ git config --global user.email <Email Address>
// Set-up name and email address to be used
$ git init
// Initialize git on current dir/folder
$ git add <file>
// You can add files one-by-one or all of them with asterisk (*)
// Include the file extension of the files
@omatt
omatt / SampleCustomFragmentTabs
Last active August 29, 2015 14:05
Custom Fragment Tabs reference
public class InfosLegalesActivity extends BaseDrawerNormalActivity {
private FragmentTabHost mTabHost;
private static TextView txtTitleInfosLegales;
@Override
protected int getLayoutContentId() {
return R.layout.layout_infoslegales;
}
@Override
@omatt
omatt / Sort
Last active August 29, 2015 14:15
/**
* Sort a 2d array
*
* @author Omatt
* @version 2015/02/22
*/
public class Sort{
private static final int maxRow = 5, maxCol = 5;
private static String cube[][] = new String[maxRow][maxCol];
public static void main(String[] args){
@omatt
omatt / CircleCrop
Last active August 29, 2015 14:16
Circle Crop Effect on Bitmap. Designed specifically for Android ImageViews.
/**
* Returns a Bitmap object with a circle crop effect.
* This can be used in an ImageView and it must use
* "centerCrop" on its scaleType to achieve desired output.
* <p>
* Reference: {@link} http://stackoverflow.com/a/14051472/2497859
*
* @param bitmap The bitmap that we're going to "circle crop"
* @return Bitmap with a circle crop overlay
* @see android.graphics.Bitmap
@omatt
omatt / English Central
Last active August 29, 2015 14:17
English Central Android demo app references
https://www.google.com.ph/search?q=android+setNavigationMode+deprecated
// ActionBar.setNavigationMode is deprecated
https://developer.android.com/training/material/lists-cards.html
http://www.binpress.com/tutorial/android-l-recyclerview-and-cardview-tutorial/156
// RecyclerView and CardView
http://javatechig.com/android/listview-with-section-header-in-android
// ListView with section header