Skip to content

Instantly share code, notes, and snippets.

View kazemihabib's full-sized avatar

Habib Kazemi kazemihabib

View GitHub Profile
@objcode
objcode / ConcurrencyHelpers.kt
Last active October 29, 2024 12:03
Helpers to control concurrency for one shot requests using Kotlin coroutines.
/* Copyright 2019 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@er-abhishek-luthra
er-abhishek-luthra / LiveDataSharedPreferences.kt
Last active April 4, 2023 11:21
LiveData implementation of SharedPreferences in Android. Get value associated in SharedPreferences corresponding to a particular key with an additional ability to observe changes made to shared preferences using LiveData
package com.chargingwatts.livedata.sharedpref;
import android.content.SharedPreferences
import androidx.lifecycle.LiveData
abstract class SharedPreferenceLiveData<T>(val sharedPrefs: SharedPreferences,
val key: String,
val defValue: T) : LiveData<T>() {
init {
@nrtkbb
nrtkbb / maya2018install.sh
Last active June 19, 2023 08:25 — forked from borgfriend/maya2017install.sh
Maya 2018 Installation on Ubuntu 18.04
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@nesquena
nesquena / PatternEditableBuilder.java
Last active October 21, 2022 10:20
PatternEditableBuilder - Easy way to create colored clickable spans within a TextView!
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.regex.Matcher;
@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active October 31, 2024 13:38
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@yqritc
yqritc / gist:ccca77dc42f2364777e1
Last active March 29, 2024 10:25
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@joshskeen
joshskeen / gist:4fcd3f7ba7d37ee69fee
Created April 22, 2015 03:03
radio button recyclerview
abstract class RadioAdapter<T> extends RecyclerView.Adapter<RadioAdapter.ViewHolder> {
public int mSelectedItem = -1;
private Context mContext;
private List<T> mItems;
public RadioAdapter(Context context, List<T> items) {
mContext = context;
mItems = items;
}
@danherbert-epam
danherbert-epam / directory.js
Last active October 8, 2016 19:17
Cross-Platflorm node.js directory node module, which includes mkdir and mkdirSync utilities which behave like the UNIX command "mkdir -p" which can be given a path with lots of non-existent nested directories and create any that are missing. One thing missing here that could be added in the future is the optional 'mode' argument, which exists in…
var fs = require('fs');
var pathSep = require('path').sep;
var directory = module.exports = {};
directory.mkdirSync = function __directory_mkdirSync__(path) {
var dirs = path.split(pathSep);
var root = "";