Skip to content

Instantly share code, notes, and snippets.

View r4hulp's full-sized avatar
🎯
Focusing

Rahul P r4hulp

🎯
Focusing
View GitHub Profile
@r4hulp
r4hulp / RemoveCookies.cs
Last active August 29, 2015 14:27
Code to remove cookies in Xamarin Android
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 August 20, 2015 04:13
Logging out from Azure Mobile Services
MobileServiceClient.Logout()
@r4hulp
r4hulp / index.html
Created August 20, 2015 04:15
Revisiting Knockout at Wrapcode.com
<div data-bind='component: {
name: "message-editor",
params: { initialText: "Hello, world!" }
}'></div>
@r4hulp
r4hulp / messageEdit.html
Created August 20, 2015 04:16
Revisiting Knockout at WrapCode.com
<message-editor params='initialText: "Hello, world!"'></message-editor>
@r4hulp
r4hulp / web.config.xml
Last active August 29, 2015 14:27
Web Config for Reverse Proxy in IIS
<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 / CircleImageView.cs
Last active March 7, 2016 19:33
Round ImageView extension for Xamarin Android
using Android.Content;
using Android.Content.Res;
using Android.Graphics;
using Android.Graphics.Drawables;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace WrapCode.Util
{
@r4hulp
r4hulp / myprofile.xml
Last active August 29, 2015 14:27
Sample Profile Layout
<!-- 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 / attr.xml
Created August 20, 2015 05:16
Custom attributes declaration for CircleImageView
<?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 / GetPathToImage.cs
Last active October 26, 2015 16:46
GetPathToImage Xamarin's implementation
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 October 26, 2015 17:07
Our implementation of GetPathToImage - Part 1
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,