Skip to content

Instantly share code, notes, and snippets.

View ishaquehassan's full-sized avatar
🎯
I may be slow to respond.

Ishaq Hassan ishaquehassan

🎯
I may be slow to respond.
View GitHub Profile
@ishaquehassan
ishaquehassan / converter.py
Last active August 4, 2023 11:34
html to json converter
import html_to_json
def get_recursively(search_dict, field):
"""
Takes a dict with nested lists and dicts,
and searches all dicts for a key of the field
provided.
"""
fields_found = []
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>T1W23Z4N56</string>
<key>teamName</key>
<string>POCKET SYSTEMS</string>
@ishaquehassan
ishaquehassan / flutter-web-deploy.yml
Created August 14, 2022 12:12
Flutter web deployment with rsync using ssh
name: CD User-Prod-Lane
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch.
on:
push:
branches:
- master
jobs:
build:
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue').default;
const Vue = window.Vue;
@ishaquehassan
ishaquehassan / responsive_view.dart
Created November 15, 2021 11:06
To handle responsive layouts
import 'package:flutter/material.dart';
class ResponsiveView extends StatelessWidget {
final Widget mobile;
final Widget tablet;
final Widget desktop;
const ResponsiveView({
Key? key,
required this.mobile,
required this.tablet,
@ishaquehassan
ishaquehassan / ListPage.dart
Created May 28, 2020 19:07
Demo Code for handling toggle of switches in singles screen
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class ListPage extends StatelessWidget{
@override
Widget build(_) => ListView.builder(
itemCount: 2,
itemBuilder: (_,itemPosition)=>_ItemView(index: itemPosition)
);
import 'package:http/http.dart' as http;
class Api{
static final String BASE_URL = "http://yourserver.com";
static final String API_KEY = "YOUR_KEY";
static String fcmTOKEN = "YOUR_TOKEN";
Future<http.Response> getRequest(String endPoint){
return http.get(BASE_URL+"/"+endPoint, headers: {
"apikey": API_KEY
public class MyThreadsApp {
public static void main (String [] args)
{
Thread currentThread = Thread.currentThread();
System.out.println(currentThread);
MyThread mt1 = new MyThread ();
mt1.setName("MyThread1");
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Map;
@ishaquehassan
ishaquehassan / RecyclerGeneralTypeAdapter
Last active January 17, 2019 14:28
A RecyclerView Adapter for general purpose simple lists. It supports all common features including itemViewType.
package com.ishaquehassan.recyclerviewgeneraladapter
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
class RecyclerGeneralTypeAdapter<T>(val data:ArrayList<T>, private val layoutFiles:Map<Int,Int>, val onGetViewType:(Int, T)->Int, val onBindItem:(itemData:T, viewHolder:RecyclerGeneralTypeAdapter<T>.RecyclerGeneralViewHolder)->Unit) : RecyclerView.Adapter<RecyclerGeneralTypeAdapter<T>.RecyclerGeneralViewHolder>(){
constructor(data:ArrayList<T>,layoutFile: Int,onBindItem:(T,RecyclerGeneralTypeAdapter<T>.RecyclerGeneralViewHolder)->Unit):this(data, mapOf(-10 to layoutFile),{_,_->-10},onBindItem)