Skip to content

Instantly share code, notes, and snippets.

View sourabh86's full-sized avatar

Sourabh Soni sourabh86

View GitHub Profile
sourabh86 /
Created April 29, 2020 08:28
Java method to deep clone any object with Jackson ObjectMapper
import com.fasterxml.jackson.databind.ObjectMapper;
public static <T> T getClone(T objectToClone, Class<T> classType){
T clonedObject = null;
ObjectMapper objectMapper = new ObjectMapper();
try {
clonedObject = objectMapper
} catch(IOException e) {
sourabh86 / activity_main.xml
Last active August 29, 2015 14:16
Main activity layout for RemoteDroid example
<RelativeLayout xmlns:android=""
xmlns:tools="" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
sourabh86 /
Last active July 24, 2020 04:14
MainActivity for RemoteDroid Example
package in.codesmith.remotedroid;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
sourabh86 /
Last active August 29, 2015 14:16
Server class which accepts commands from a remote android client over LAN. Used as demo code for
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.MouseInfo;
import java.awt.Point;
sourabh86 /
Last active November 21, 2021 06:35
Code to send data to Google Docs sheet from Android activity
package in.codesmith.contactusexample;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
sourabh86 / NewClass.js
Last active August 29, 2015 14:15
Class in ES6
class NewClass extends DummyClass {
constructor(variableA, variableB) {
super(variableA, variableB); = NewClass.defaulIdGenerator();
this.elements = [];
update(test) {
sourabh86 / Default.js
Created January 28, 2015 18:32
Overriding Ext.layout.Default. This should be placed under /app/override/layout/
Ext.define('Ext.layout.override.Default', {
override: 'Ext.layout.Default',
removeInnerItem: function(item) {
// check for valid element
if (item.element !== null) {
//save each row in different variable
$top_row = array(5,21,31,60,81);
$mid_row = array(17,37,59,63,88);
$bottom_row = array(9,39,45,77,90);
//No numbers to check
echo "No Input Yet!!";
sourabh86 /
Created October 4, 2013 14:43
Main class for hibernate 4 example
import java.util.Iterator;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
sourabh86 / employee.hbm.xml
Created October 4, 2013 14:39
Employee hibernate mapping for hibernate 4 example
<?xml version="1.0"?><!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<hibernate-mapping package="">
<class name="" table="EMPLOYEE">
<id name="id" type="long" column="ID" length="20">
<generator class="assigned"/>
<property name="firstName" column="FIRSTNAME" type="string" length="20">