Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrii Chubko qwertyfinger

View GitHub Profile
@sarthology
sarthology / regexCheatsheet.js
Created Jan 10, 2019
A regex cheatsheet 👩🏻‍💻 (by Catherine)
View regexCheatsheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
View SharedPrefManager.kt
class SharedPrefManager(context: Context) {
private val preferences = PreferenceManager.getDefaultSharedPreferences(context.applicationContext)
var booleanField by PreferenceFieldDelegate.Boolean("boolean_field")
var intField by PreferenceFieldDelegate.Int("int_field")
var stringField by PreferenceFieldDelegate.String("string_field")
private sealed class PreferenceFieldDelegate<T>(protected val key: kotlin.String) : ReadWriteProperty<SharedPrefManager, T> {
class Boolean(key: kotlin.String) : PreferenceFieldDelegate<kotlin.Boolean>(key) {
@pavlospt
pavlospt / CandidatesAdapter.java
Created Oct 2, 2016
OnViewRecycled Implementation
View CandidatesAdapter.java
@Override
public void onViewRecycled(Candidates holder) {
if(holder != null) {
holder.binding.getCandidateVM().removePropertyChangedCallback();
holder.binding.setCandidateVM(null);
holder.binding.setHighlightTerm(null);
holder.binding.setShowJobTitle(false);
holder.binding.setShowStage(false);
holder.binding.executePendingBindings();
Glide.clear(holder.binding.candidateBrowserAvatar);
@PurpleBooth
PurpleBooth / README-Template.md
Last active Sep 14, 2021
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@staltz
staltz / introrx.md
Last active Sep 16, 2021
The introduction to Reactive Programming you've been missing
View introrx.md