Skip to content

Instantly share code, notes, and snippets.

View umanda's full-sized avatar
🎯
Focusing

Umanda Jayobandara umanda

🎯
Focusing
View GitHub Profile
@umanda
umanda / OnItemSelectedListener.java
Created August 17, 2016 16:46 — forked from andreynovikov/OnItemSelectedListener.java
Complete working solution for Android action bar tabs with fragments having separate back stack for each tab.
// Custom interface that enables communication between Fragment and its Activity
public interface OnItemSelectedListener
{
public void onItemSelected(String item);
}
@umanda
umanda / sample.java
Created August 15, 2016 06:07
Refresh/Reload/Re instantiate a Fragment in an android tab system
// In Activity:
@Override
public void onTabSelected(ActionBar.Tab tab,
FragmentTransaction fragmentTransaction) {
// When the given tab is selected, switch to the corresponding page in
// the ViewPager.
mViewPager.setCurrentItem(tab.getPosition());
@umanda
umanda / form_submit.php
Created August 5, 2016 10:10
PHP, jQuery, and AJAX Powered Contact Form
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form Data Submit</title>
<link rel="stylesheet" href="css/bootstrap.css">
<style>
#contact label.error {
color: #e9266d;
}
@umanda
umanda / 51-android.rules
Created July 13, 2016 06:47
Configure hardware devices to debug / test android app on Linux ( Ubuntu ) for Android Studio
1) sudo vim /etc/udev/rules.d/51-android.rules
Add SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666",
ATTR{idVendor}=="0bb4" > this is your mobile device vendor
for more info please find following url
https://developer.android.com/studio/run/device.html
2) sudo chmod 644 /etc/udev/rules.d/51-android.rules
@umanda
umanda / regex
Created April 6, 2016 04:36
Useful Regex
// Regular expression for extracting tag attributes
<name attribute=value attribute="value" attribute='value'>
(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?
@umanda
umanda / style.css
Created March 16, 2016 05:49
Style Placeholder Text
::-webkit-input-placeholder {
color: red;
}
input:-moz-placeholder { /* Firefox 18- */
color: red;
}
input::-moz-placeholder { /* Firefox 19+ */
color: red;
@umanda
umanda / encode-decode.php
Created March 15, 2016 13:44
How to create two way encode/decode methods using use-specific key in PHP
<?php
$key = "secret_key";
$data ="String";
// Encodeing
$encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $data, MCRYPT_MODE_CBC, md5(md5($key))));
// Decoding
$decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encoded), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
@umanda
umanda / jquery_plugin_boilerplate.js
Created December 14, 2015 08:47
jQuery Plugin Boilerplate
// jQuery Plugin Boilerplate
// A boilerplate for kick-starting jQuery plugins development
// version 1.3, May 07th, 2011
// by Stefan Gabos
// with help from Roger Padilla, Shinya, JohannC, Steven Black, Rob Lifford
// remember to change every instance of "pluginName" to the name of your plugin!
(function($) {
// here it goes!
@umanda
umanda / .gitignore
Created October 21, 2015 07:06
Magento gitignore file
.htaccess.sample
.modgit/
.modman/
app/code/community/Phoenix/
app/code/community/Cm/
app/code/core/
app/design/adminhtml/default/default/
app/design/frontend/base/
app/design/frontend/rwd/
app/design/frontend/default/blank/
@umanda
umanda / fix.js
Created October 14, 2015 09:07
Autocomplete requires you to click twice in iOS after update to 1.11.0
$("#input").autocomplete({
open: function(event, ui) {
$('.ui-autocomplete').off('menufocus hover mouseover mouseenter');
}
});