Skip to content

Instantly share code, notes, and snippets.

View maheshgiri's full-sized avatar
:octocat:
Work from home building something

Mahesh Giri maheshgiri

:octocat:
Work from home building something
  • pune
View GitHub Profile
@maheshgiri
maheshgiri / gist:76e624ddd9e83d47b853c9f189767581
Last active November 17, 2016 09:56
Swift 3 Create Custom Segue
In swift3 create one segue -add identifier -add and set in segue(storyboard) custom storyboard class from cocoatouch file -In custom class override perform()
'override func perform() {
let sourceViewController = self.source
let destinationController = self.destination
let navigationController = sourceViewController.navigationController
// Pop to root view controller (not animated) before pushing
if self.identifier == "your identifier"{
navigationController?.popViewController(animated: false)
navigationController?.pushViewController(destinationController, animated: true)
add ```UIScrollViewDelegate``` in tableview/collectionview
``` var isDataLoading:Bool=false
var pageNo:Int=1
var limit:Int=0
var offset:Int=0
var connectionCount:Int=0```
```override method func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
if scrollView == collectionView{
@maheshgiri
maheshgiri / InviteFromContacts.swift
Last active January 24, 2017 06:19
Add Pagination in existing array in IOS using swift.
//
// InviteFrdsController.swift
import UIKit
import Contacts
import AlamofireImage
import MessageUI
class InviteFrdsController: UIViewController,UITableViewDelegate,UITableViewDataSource,MFMessageComposeViewControllerDelegate,UIScrollViewDelegate
{
/*
* Copyright 2016 Google Inc.
*
* 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
@maheshgiri
maheshgiri / Android Studio Generating Signed APK Error Resolve
Last active March 23, 2017 04:52
Android Studio Generating Signed APK Error Resolve
add this in gradle
ValidFragment Error was beacause of fragment instance was not static in payumoney jar.
The below one only suppresses warning and we can build it.
android{
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
@maheshgiri
maheshgiri / Utils.java
Created September 4, 2017 09:33
Convert Hex to Decimal by IEEE Standards
import android.util.Log;
import com.android.sustlabs.pojo.BinaryObj;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
@maheshgiri
maheshgiri / GridLayoutManager.java
Created October 9, 2017 17:03 — forked from vganin/GridLayoutManager.java
Workaround for bug with RecycleView focus scrolling when navigating with d-pad (http://stackoverflow.com/questions/31596801/recyclerview-focus-scrolling)
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
/**
* {@link GridLayoutManager} extension which introduces workaround for focus finding bug when
* navigating with dpad.
*
* @see <a href="http://stackoverflow.com/questions/31596801/recyclerview-focus-scrolling">http://stackoverflow.com/questions/31596801/recyclerview-focus-scrolling</a>
@maheshgiri
maheshgiri / GroupViewHolder
Created November 30, 2017 11:28 — forked from RockerFlower/GroupViewHolder
A RecyclerView with multiple view type.
public class GroupViewHolder extends MainViewHolder {
@InjectView ( R.id.groupTitle )
TextView mTitle;
@InjectView ( R.id.groupContent )
TextView mContent;
public GroupViewHolder ( View itemView ) {
super ( itemView );
@maheshgiri
maheshgiri / FRBWindow+Extra.h
Created November 30, 2021 05:48 — forked from fernyb/FRBWindow+Extra.h
NSWindow Categories to get screen capture of NSWindow including the shadow
@interface NSWindow (FRBExtra)
- (NSImage *)windowImage;
- (CGImageRef)windowImageShot;
@end
NSWindow *topmostAppWindowAtPoint(CGPoint screenPoint)
{
const CGWindowLevel kScreensaverWindowLevel = CGWindowLevelForKey(kCGScreenSaverWindowLevelKey);
/* This function returns a pointer to the app's topmost NSWindow that
the point `screenPoint` is over. The important distinction here is that
this function takes _all_ system windows into consideration and will return
`nil` if there is a system window (or NSMenu etc.) that the cursor
is over which is atop the app window, which is information that
can't otherwise be gleaned by checking against `[NSApp orderedWindows]` etc.