Skip to content

Instantly share code, notes, and snippets.

@MatthewZMD
MatthewZMD / .mbsyncrc
Last active March 27, 2024 00:46
Gmail .mbsyncrc Sample
# mbsyncrc based on
# http://www.ict4g.net/adolfo/notes/2014/12/27/EmacsIMAP.html
# ACCOUNT INFORMATION
IMAPAccount gmail
# Address to connect to
Host imap.gmail.com
User <EMAIL_HERE>
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.emacs.d/mu4e/.mbsyncpass-<EMAIL_HERE>.gpg"
AuthMechs LOGIN
SSLType IMAPS
@blessanm86
blessanm86 / german-driving-license.md
Last active May 3, 2024 15:15
Quick Ref Notes for German Driving License Test

This is unmaintained and was created for personal use. As I passed the exam I have no use to keep this up to date. Feel free to fork

What are the consequences for a person driving a motor vehicle under the influence of drugs (e.g. hashish, heroin, cocaine)?

[x] Confiscation of driving licence or driving ban
[x] Compulsory medical/psychological examination
[x] Fine and/or imprisonment

In which instances do you have to approach a pedestrian crossing with particular care?

import android.os.Looper
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.Adapter
import androidx.recyclerview.widget.RecyclerView.NO_POSITION
import androidx.recyclerview.widget.RecyclerView.ViewHolder
class ComposableAdapter: Adapter<ViewHolder>() {
private val adapterForViewType = LinkedHashMap<Int, Adapter<ViewHolder>>()
final class Loader: BindableObject {
let didChange = PassthroughSubject<Data?, Never>()
var task: URLSessionDataTask!
var data: Data? = nil {
didSet {
didChange.send(data)
}
}
init(_ url: URL) {
@LouisCAD
LouisCAD / LifecycleCoroutines.kt
Last active July 3, 2022 11:47
CoroutineScope and Job integration with Lifecycle for Android. Meant to be used for your coroutines in lifecycle aware components. OUTDATED. See up to date implementation here: https://github.com/LouisCAD/Splitties/tree/master/modules/lifecycle-coroutines
import android.arch.lifecycle.GenericLifecycleObserver
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY
import android.arch.lifecycle.LifecycleOwner
import kotlinx.coroutines.experimental.CoroutineScope
import kotlinx.coroutines.experimental.Dispatchers
import kotlinx.coroutines.experimental.Job
import kotlinx.coroutines.experimental.android.Main
fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job {
### Phrase:
hi guys,
hey guys,
hello guys,
you guys,
guys
### Respose:
Did you mean team?
Did you mean all?
@android10
android10 / README.md
Last active November 29, 2020 00:50
Keep a FORKED repository synced with UPSTREAM on Github

Configure a remote that points to the upstream repository in Git.

  • List the current configured remote repository for your fork.
git remote -v
origin  git@github.com:YOUR_USERNAME/YOUR_FORK.git (fetch)
origin  git@github.com:YOUR_USERNAME/YOUR_FORK.git (push)
@Dao
interface NoteDao {
@Insert(onConflict = OnConflictStrategy.ABORT)
fun insert(note: Note): Long
@Update(onConflict = OnConflictStrategy.ABORT)
fun update(note: Note): Int
@Query("SELECT * FROM notes")
fun observeAllNotes(): Flowable<Note>
/*
* Copyright (C) 2017 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@wverdese
wverdese / PrintWeeks.java
Created July 6, 2017 12:19
Week-Of-Year and Week-Based-Year for GroupBy for weeks
/* Turns out that DateTimeFormatter has a nice way of providing a value for grouping by elements with a LocalDate ordered by weeks.
* This works even when the week is split between December and January. Check out this method:
*/
public void test() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("YYYY-ww");
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("dd-MM-yyyy");
for (int year = 2016; year >= 2015; year--) {
for (int month = 12; month >= 1; month = month - 11) {
for (int day = 31; day >= 1; day--) {
LocalDate localDate = LocalDate.of(year, month, day);