Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

GVSharma gvsharma

🎯
Focusing
Block or report user

Report or block gvsharma

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gvsharma
gvsharma / System Design.md
Created Jul 2, 2019 — forked from vasanthk/System Design.md
System Design Cheatsheet
View System Design.md

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@gvsharma
gvsharma / CustomFragmentsPresenter.cs
Created Oct 6, 2017 — forked from martijn00/CustomFragmentsPresenter.cs
Custom fragment handling in MvvmCross and Xamarin
View CustomFragmentsPresenter.cs
public class CustomFragmentsPresenter : MvxFragmentsPresenter
{
public interface IMvxFragmentHostEx : IMvxFragmentHost
{
void Close(IMvxViewModel viewModel);
void ChangePresentation (MvxPresentationHint hint);
}
private IMvxNavigationSerializer _serializer;
View MonkeysPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Monkeys.Views.MonkeysPage"
xmlns:local="clr-namespace:Monkeys.Views;assembly=Monkeys"
Title="Monkeys">
<ListView x:Name="list"
ItemsSource="{Binding MonkeysGrouped}"
ItemTapped="OnItemSelected"
IsGroupingEnabled="True"
View gist:da6afe9f1accbf91711805191d4d23b1
using System;
using System.Linq;
using Xamarin.Forms;
using System.Collections.Generic;
using System.ComponentModel;
namespace SampleApp
{
// Inherit from this page to get a multi-select option in XF
public class SelectMultipleBasePage<T> : ContentPage
View gist:57d0668a8826ae6fe58ced5eb1e843cd
public class CustomAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
//our items
List<Generic> items = new Arraylist<>();
//headers
List<View> headers = new ArrayList<>();
//footers
List<View> footers = new ArrayList<>();
public static final int TYPE_HEADER = 111;
public static final int TYPE_FOOTER = 222;
View gist:b46d69a278060e64b7df173e6e50e333
public class BlurUtil {
public static Bitmap blur(Context context, Bitmap sentBitmap, int radius) {
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
final RenderScript rs = RenderScript.create(context);
final Allocation input = Allocation.createFromBitmap(rs, sentBitmap, Allocation.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_SCRIPT);
View SimpleXmlRequest.java
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
@gvsharma
gvsharma / getTmepFile() method
Created Jun 5, 2014
getting an image from camera or gallery and set it as
View getTmepFile() method
private Uri getTempFile(){
File root = new File(Environment.getExternalStorageDirectory(), "fashion_swap");
if (!root.exists()){
root.mkdirs();
}
String filename=""+System.currentTimeMillis();
File file = new File(root,filename+".jpeg" );
Uri muri = Uri.fromFile(file);
selectedImagePath = muri.getPath();
Log.v("take picture path",selectedImagePath);
@gvsharma
gvsharma / dataIntoPdf method
Last active Aug 29, 2015
Generating pdf with qPDF(qoppa software) library(refer http://www.qoppa.com/android/pdfsdk/)
View dataIntoPdf method
public void dataIntoPdf(int noOfLines, ArrayList<Info> bookInfosById, PDFCanvas canvasId){
try {
float x = 40f;
float y = 60f;
for (int j = 0; j < bookInfosById.size();j++) {
int z = j;
Info myInfos = bookInfosById.get(j);
if (z < noOfLines) {
for (int v = 0; v <= z; v++) {
if (z == v) {
@gvsharma
gvsharma / download an image from server
Created Jun 5, 2014
dounloading an image from server and save it in file
View download an image from server
Here arg[0] --> is the image url that we have to pass to this asynctask as parameter.
public class DownloadImage extends AsyncTask<String, Integer, Bitmap> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
You can’t perform that action at this time.