Skip to content

Instantly share code, notes, and snippets.

View SachinR90's full-sized avatar
💭
I may be slow to respond.

Sachin Rao SachinR90

💭
I may be slow to respond.
  • Coditas
  • Pune
View GitHub Profile
@SachinR90
SachinR90 / ArrayDiff.swift
Created January 8, 2021 06:10 — forked from praeclarum/ArrayDiff.swift
A generic diffing operation that can calculate the minimal steps needed to convert one array to another. It can be used to generate standard diffs, or it can be used more creatively to calculate minimal UI updates.
//
// ArrayDiff.swift
//
// Created by Frank A. Krueger on 6/30/15.
// Copyright © 2015 Krueger Systems, Inc. All rights reserved.
// License: MIT http://opensource.org/licenses/MIT
//
import Foundation
@SachinR90
SachinR90 / README.md
Last active February 5, 2020 10:22
iOS - Text with Pattern
  • Add image named "pattern" to assets.
  • Enable slicing, to make the pattern/image repeatable.
    1. Click the image
    2. Select 2x
    3. Click 'Show Slicing'
    4. Select option with cross icon
  1. Drag all lines to 4 corners.
//Swift 4+
import Foundation
///given formula for representing bits in in number
/// bits[index]*(-2)^index
func getNumber(from bits:[Int]) -> Int{
var number = 0
for (index, value) in bits.enumerated(){
number = number + value * Int(powf(-2, Float(index)))
}
@SachinR90
SachinR90 / CustomOnTouchListener.java
Created October 5, 2017 11:58
CustomOnTouchListener
import android.os.SystemClock;
import android.support.animation.DynamicAnimation;
import android.support.animation.SpringAnimation;
import android.support.animation.SpringForce;
import android.view.MotionEvent;
import android.view.View;
import java.lang.ref.SoftReference;
/**
@SachinR90
SachinR90 / PagingRecyclerView
Created October 5, 2017 11:26 — forked from mgarnerdev/PagingRecyclerView
Horizontal Snapping RecyclerView with Page Indication
import android.content.Context;
import android.graphics.PointF;
import android.support.v7.widget.LinearSmoothScroller;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.MotionEvent;
/**
@SachinR90
SachinR90 / CommonComponent.java
Last active October 5, 2017 11:36
CustomFrameLayout - This layout specifies its own width/height based on the Device/Parent width/height.
package com..example;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
/**
* Created by SachinR on 7/21/2017.
*/
@SachinR90
SachinR90 / TimeLineIndicatorItemDecoration.java
Last active April 27, 2018 22:41
Exploring ItemDecoration for RecyclerView. Drawing Timelines
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software