Skip to content

Instantly share code, notes, and snippets.

Avatar
💪
On learning spree!

Rahul P r4hulp

💪
On learning spree!
View GitHub Profile
@r4hulp
r4hulp / myprofile.xml
Last active Aug 29, 2015
Sample Profile Layout
View myprofile.xml
<!-- Don't forget to add custom namespace in first xml element, otherwise get ready for exceptions and errors -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:id="@+id/parentLayout">
@r4hulp
r4hulp / RemoveCookies.cs
Last active Aug 29, 2015
Code to remove cookies in Xamarin Android
View RemoveCookies.cs
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
Android.Webkit.CookieManager.Instance.RemoveAllCookies(null);
else
Android.Webkit.CookieManager.Instance.RemoveAllCookie();
MobileServiceClient.Logout();
@r4hulp
r4hulp / AzureMobileAgent.cs
Created Aug 20, 2015
Logging out from Azure Mobile Services
View AzureMobileAgent.cs
MobileServiceClient.Logout()
@r4hulp
r4hulp / index.html
Created Aug 20, 2015
Revisiting Knockout at Wrapcode.com
View index.html
<div data-bind='component: {
name: "message-editor",
params: { initialText: "Hello, world!" }
}'></div>
@r4hulp
r4hulp / attr.xml
Created Aug 20, 2015
Custom attributes declaration for CircleImageView
View attr.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CircleImageView">
<attr name="border" format="boolean"></attr>
<attr name="border_width" format="dimension"></attr>
<attr name="border_color" format="color"></attr>
<attr name="shadow" format="boolean"></attr>
</declare-styleable>
@r4hulp
r4hulp / messageEdit.html
Created Aug 20, 2015
Revisiting Knockout at WrapCode.com
View messageEdit.html
<message-editor params='initialText: "Hello, world!"'></message-editor>
@r4hulp
r4hulp / web.config.xml
Last active Aug 29, 2015
Web Config for Reverse Proxy in IIS
View web.config.xml
<rewrite>
<rules>
<rule name="Route Requests from localhost api to Remote API url" stopProcessing="true">
<match url="^api/(.*)" />
<conditions>
<add input="{CACHE_URL}" pattern="^(https?)://" />
</conditions>
<action type="Rewrite" url="https://www.wrapcode.com:1234/api/{R:1}" logRewrittenUrl="true" />
<serverVariables>
<set name="HTTP_ACCEPT_ENCODING" value="" />
@r4hulp
r4hulp / GetPathToImage.cs
Last active Oct 26, 2015
GetPathToImage Xamarin's implementation
View GetPathToImage.cs
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
if ((requestCode == PickImageId) && (resultCode == Result.Ok) && (data != null))
{
Uri uri = data.Data;
_imageView.SetImageURI(uri);
string path = GetPathToImage(uri);
@r4hulp
r4hulp / GetPathToImage.cs
Last active Oct 26, 2015
Our implementation of GetPathToImage - Part 1
View GetPathToImage.cs
private string GetPathToImage(Android.Net.Uri uri)
{
ICursor cursor = this.ContentResolver.Query(uri, null, null, null, null);
cursor.MoveToFirst();
string document_id = cursor.GetString(0);
document_id = document_id.Split(':')[1];
cursor.Close();
cursor = ContentResolver.Query(
Android.Provider.MediaStore.Images.Media.ExternalContentUri,
@r4hulp
r4hulp / GetPathToImage.cs
Created Oct 26, 2015
Our Implementation GetPathToImage - Part 2
View GetPathToImage.cs
private string GetPathToImage(Android.Net.Uri uri)
{
ICursor cursor = this.ContentResolver.Query(uri, null, null, null, null);
cursor.MoveToFirst();
string document_id = cursor.GetString(0);
if (document_id.Contains(":"))
document_id = document_id.Split(':')[1];
cursor.Close();
cursor = ContentResolver.Query(
You can’t perform that action at this time.