Skip to content

Instantly share code, notes, and snippets.

View informramiz's full-sized avatar
🏠
Working from home

Ramiz Raja informramiz

🏠
Working from home
View GitHub Profile
class MainActivity : AppCompatActivity() {
private val items = mutableListOf("Item1", "Item2", "Item3", "Item4", "Item5", "Item6")
private val simpleAdapter = SimpleAdapter()
private val itemTouchHelper = ItemTouchHelper(object : ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP or ItemTouchHelper.DOWN, ItemTouchHelper.LEFT) {
override fun onMove(
recyclerView: RecyclerView,
viewHolder: RecyclerView.ViewHolder,
target: RecyclerView.ViewHolder
): Boolean {
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
version = libraryVersion
// Create the pom configuration: A POM object is required to publish to JCenter
def pomConfig = {
licenses {
license {
name licenseName
@informramiz
informramiz / maven-publish.gradle
Created April 26, 2020 15:38
Gradle file to publish library to maven repo using maven publish gradle plugin.
/**
* create following variables in your project level build.gradle file's extended block
* ext {
* lib_repo_username = "repo user name"
* lib_repo_password = "repo password"
* lib_repo_url = "lib repo url"
* lib_group_id = "group id"
* lib_artifact_id = "artifact id"
* lib_version_name = "version name"
* }
@informramiz
informramiz / CollectionDataSource.swift
Created December 11, 2019 16:37
A common data source for CollectionView with NSFetchedResultsControllerDelegate
//
// CollectionDataSource.swift
// VirtualTourist
//
// Created by Ramiz on 10/12/2019.
// Copyright © 2019 RR Inc. All rights reserved.
//
import Foundation
import CoreData
@informramiz
informramiz / ListDataSource.swift
Created December 7, 2019 15:02
A generic data source class for making UITableView with NSFetchedResultsController
//
// ListDataSource.swift
// Mooskine
//
// Created by Ramiz on 07/12/2019.
//
import Foundation
import CoreData
import UIKit
@informramiz
informramiz / NestedLinkedList.py
Created October 19, 2019 02:55
Suppose you have a linked list where the value of each node is a sorted linked list (i.e., it is a nested list). Your task is to flatten this nested list—that is, to combine all nested lists into a single (sorted) linked list.
# NestedLinkedList inherit LinkedList class, just for organization purposes
# otherwise NestedLinkedList and LinkedList are both exactly thing same
class NestedLinkedList(LinkedList):
def flatten(self):
"""
Idea is that each time we take 2 nodes' values (each node value is a LinkedList)
and merge them. The nodes' values will be: first the already merged list
which at start would be None as we are just starting, second the
current node value (a LinkedList as each value is a LinkedList())
"""
@informramiz
informramiz / python-class.py
Created September 24, 2019 14:02
Use class to keep track of average lane lines
class Lane():
def __init__(self):
#everything starting with `self` keyword will be consider property/data memeber/field of this class
#here we declare all the fields/variables of this class that we need to keep track of data
#flag to represent whether first polynomial fitting has been done
#and now that data can be used for future
self.is_ready = False
#fitting done on current frame
self.current_fit = None
@informramiz
informramiz / p1.ipynb
Last active September 23, 2019 22:21
P1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@informramiz
informramiz / threads.cpp
Created September 14, 2019 17:34
How to pass data to threads
#include <iostream>
#include <thread>
#include <list>
#include <vector>
#include <string>
struct ImageProcessor {
void process(std::string path) {
std::cout << "image processed" << std::endl;
}
@informramiz
informramiz / flicker-photos-API-call.swift
Created September 5, 2019 06:52
Flicker photos API call
import Foundation
class AppClient {
struct Auth {
static var key = "YOUR_API_KEY"
}
enum Endpoint {
static let baseUrl = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=\(Auth.key)"
case base