Skip to content

Instantly share code, notes, and snippets.

View sajjadjaved01's full-sized avatar

Sajjad Javed sajjadjaved01

View GitHub Profile
@sajjadjaved01
sajjadjaved01 / test.cs
Created January 12, 2018 09:38
report
{
var con = new MySqlConnection(
"server=localhost;userid=root;password=admin;database=POS_DB;persistsecurityinfo=True;");
var cmd = new MySqlCommand(
"Select DISTINCT Sales.InvoiceNo, Sales.CustomerID, Sales.GrandTotal, Sales.TotalPayment, Sales.PaymentDue, Sales.InvoiceDate, ProductSold.ConfigID, ProductSold.ProductName, ProductSold.Quantity, ProductSold.Price, ProductSold.TotalAmount " +
"From ProductSold, Sales, Branch " +
"Where Sales.InvoiceNo='INV-559216' And branch.BranchID='1'", con);
var sqlData = new MySqlDataAdapter { SelectCommand = cmd };
sqlData.Fill(set, "Sales");
sqlData.Fill(set, "ProductSold");

Downloading Videos from Pluralsight

Disclaimer

Pluralsight do not permit users to download their videos.
If you are an user of pluralsight you have agreed with their ToS,
and are thusly refrained from doing so.
Use this knowledge at your own risk.

youtube-dl for Windows

@sajjadjaved01
sajjadjaved01 / onItemClickListener.kt
Last active August 18, 2019 08:58
Get RecyclerView onItemClick to parent activity. Android
package com.reactivespace.tylsinmcwalet.ui
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
@sajjadjaved01
sajjadjaved01 / DataBinding_with_ImageView.kt
Created August 28, 2019 14:24
DataBinding with ImageView & Glide
//Remember: The method needs to be public static and the first parameter will be the view. This is very important.
// this is for just for single loading.
companion object {
@JvmStatic
@BindingAdapter("profileImage")
fun loadImage(view: ImageView, profileImage: String) {
Glide.with(view.context)
.load(profileImage)
.into(view)
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
#parse("File Header.java")
@sajjadjaved01
sajjadjaved01 / DemoData.kt
Last active February 25, 2021 09:43
Saving retrofit response Model to shared preferences. Using Generics
data class DemoData(
val email: String,
val name: String,
val username: String
)
// Usage For getting saved data.
var userData = getModelPref(getPreferences, localUserData, DemoData::class.java)
@sajjadjaved01
sajjadjaved01 / ActivitiesLaunchingWay.kt
Created December 27, 2019 07:40 — forked from wajahatkarim3/ActivitiesLaunchingWay.kt
Kotlin Extensions for simpler, easier and funw way of launching of Activities
/**
* Kotlin Extensions for simpler, easier and funw way
* of launching of Activities
*/
inline fun <reified T : Any> Activity.launchActivity (
requestCode: Int = -1,
options: Bundle? = null,
noinline init: Intent.() -> Unit = {})
{
@sajjadjaved01
sajjadjaved01 / AndroidAnimation.kt
Created January 8, 2020 14:40
Android Animation using AndroidX Transition API.
/* usage fabMessages.toggle(Slide(Gravity.Bottom)) : Slide() & Fade() */
fun View.toggle(transition: Transition) {
transition.duration = 500
transition.addTarget(this)
TransitionManager.beginDelayedTransition(this.parent as ViewGroup, transition)
visibility = if (!isVisible) View.VISIBLE else View.GONE
}
// Usage extend any of your view with toggle, like (Button, FabButton, etc).
// use views Id.
@sajjadjaved01
sajjadjaved01 / State.kt
Last active March 31, 2021 12:01
Handle API States
sealed class State<T> {
class Loading<T> : State<T>()
data class Success<T>(val data: T) : State<T>()
data class Error<T>(val message: String) : State<T>()
companion object {
/**
@sajjadjaved01
sajjadjaved01 / Dropdown.tsx
Last active January 18, 2023 09:04
Multiselect / Single-Select dropdown.
import { MaterialIcons } from "@expo/vector-icons";
import React, { useEffect, useState } from "react";
import { FlatList, Image, Pressable, StyleSheet, Text, TouchableOpacity, View, ViewStyle } from "react-native";
import DashedLine from "react-native-dashed-line";
import { RFValue } from "react-native-responsive-fontsize";
var dropItem: DropdownItem[] = [{ itemName: "Pakistan" }, { selected: false, itemName: "United States" }];
const handler = (item: DropdownItem) => {
console.log("This is callback", item);