Skip to content

Instantly share code, notes, and snippets.

@Abdallah-Abdelazim
Abdallah-Abdelazim / BaseDao.java
Created March 31, 2020 01:44
A BaseDao interface that provides the methods needed for inserting, updating & deleting an entity in a Room Dao interface.
package com.example.app.data.local.dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Update;
import java.util.List;
/**
@Abdallah-Abdelazim
Abdallah-Abdelazim / SingleLiveEvent.java
Last active November 19, 2020 11:48
SingleLiveEvent: A lifecycle-aware observable that sends only new updates after subscription, used for events like navigation and Snackbar messages.
/*
* Copyright 2017 Google Inc.
* Copyright 2020 Abdallah Abdelazim.
*
* 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
*
@Abdallah-Abdelazim
Abdallah-Abdelazim / BcdConverter.java
Last active October 27, 2019 10:39 — forked from neuro-sys/BCD.java
BCD Conversion in Java
/*
* Copyright 2010 Firat Salgur
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
@Abdallah-Abdelazim
Abdallah-Abdelazim / StrPad.java
Created October 21, 2019 13:06
Useful utility methods for controlling the length & adding padding to strings in Java.
/**
* Useful utility methods for controlling the length & adding padding to strings.
*
* @author Abdallah Abdelazim
*/
public final class StrPad {
/**
* Prevent instantiation.
*/
@Abdallah-Abdelazim
Abdallah-Abdelazim / linux_desktop_entry_template.md
Last active June 1, 2021 19:01
Template for creating desktop entries (launchers) on Linux

Template for creating desktop entries (launchers) on Linux

Create the following file, with your favourite editor:

  • Across all users: /usr/share/applications/application_name.desktop
  • For current user only: ~/.local/share/applications/application_name.desktop

Add the following content to the file and save:

[Desktop Entry]
Version=1.0
@Abdallah-Abdelazim
Abdallah-Abdelazim / oojs_es5.js
Last active June 19, 2023 17:24
Complete Object-Oriented JavaScript example (ES5).
function Person(first, last, age, gender, interests) {
this.name = {
first,
last
};
this.age = age;
this.gender = gender;
this.interests = interests;
};