Skip to content

Instantly share code, notes, and snippets.

View Gryzor's full-sized avatar

Martin Marconcini Gryzor

View GitHub Profile
class Whatever {
@Nullable
private MessagesListener listener;
@NonNull
private ArrayList<String> localMessages = new ArrayList<>();
public void setListener(@Nullable MessageListener callback) {
listener = callback;
@Gryzor
Gryzor / MainActivity.kt
Created June 10, 2019 17:37
Scrolling With a SeekBar
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
scrollView.viewTreeObserver.addOnGlobalLayoutListener {
val scroll: Int = getScrollRange(scrollView)
seekBar.min = 0
seekBar.max = scroll
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
private void configureViews() {
// Create a Constraint Set and clone our constraints
ConstraintSet constraintSet = new ConstraintSet();
// Create our progress bar…
ProgressBar progressBar = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleLarge);
progressBar.setIndeterminate(true);
progressBar.setId(generateViewId());
// Add it to our hierarchy
public ProgressConstraintLayout(Context context, AttributeSet attrs) {
super(context, attrs);
configureViews();
}
private void configureViews() {
// Create a Constraint Set and clone our constraints
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(this);
import Swift
/*
Now, a nice string is one with all of the following properties:
It contains a pair of any two letters that appears at least twice in the string without overlapping, like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it overlaps).
It contains at least one letter which repeats with exactly one letter between them, like xyx, abcdefeghi (efe), or even aaa.
*/
var d5input: [String] = ["qjhvvvzxzqqjkmpb", "sknufchjdvccccta", "ugqblsonqaxycvkg", "yevmbiyrqdqrmlbw", "bvpvwrhoyneorcmm", "gbyjqzcsheaxnyib", "knhsmdjssycvuoqf","nizjxiwdakpfttyh", "nwrkbhorhfqqoliz", "ynsqwvwuwzqpzzwp", "yitscrgexjfclwwh", "dhajwxqdbtrfltzz", "bmrfylxhthiaozpv", "frvatcvgknjhcndw", "xlvtdmpvkpcnmhya", "pxpemuzuqzjlmtoc", "dijdacfteteypkoq", "knrcdkrvywagglnf", "viuajtspnvnptia", "xvlqzukmwbcjgwho"]
var pairs = [String:Int]()
// getter/setter ommited
class A extends RealmObject {
@PrimaryKey
private String name;
}
class B extends RealmObject {
@PrimaryKey
private String name;
private A a;
}