Skip to content

Instantly share code, notes, and snippets.

@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 4, 2024 14:32
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@LordRaydenMK
LordRaydenMK / ValueClass.kt
Created February 2, 2020 22:09
Kotlin compiler plugin built with arrow-meta. Generates equals, hashCode and toString for classes annotated with @valueclass
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CLASS)
annotation class ValueClass
public class ResourceProvider {
private final Context context;
@Inject
public ResourceProvider(Context context) {
this.context = context;
}
@NonNull
@nickbutcher
nickbutcher / MainActivity.java
Last active August 20, 2021 16:15
A quick sample of the new physics-based animation library added in Support Library 25.3.0 docs: https://developer.android.com/reference/android/support/animation/package-summary.html output: https://twitter.com/crafty/status/842055117323026432
/*
* Copyright 2017 Google Inc.
*
* 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
  • A dependency is a coupling between two classes usually because one of them uses the other to do something.
  • Dependency injection consists of passing dependencies (inject them) via constructor in order to extract the task of creating modules out from other modules. Objects are instantiated somewhere else and passed as constructor attributes when creating the current object.
  • A dependency injector is another module in our app that is in charge of providing instances of the rest of modules and inject their dependencies. It's responsibility is the creation of modules is localized in a single point in our app, and we have full control over it.
  • Dagger is a dependency injector designed for low-end devices. Most dependency injectors rely on reflection to create and inject dependencies. Reflection is very time consuming on low-end devices, and specially on old android versions. Dagger, however, uses a pre-compiler that creates all the classes it needs to work. That way, no reflection is needed. Dagger is
@alexrqs
alexrqs / update-tags.md
Last active February 5, 2020 18:30
Update github tags with new commits
Create a branch with the tag
	git branch {tagname}-branch {tagname}
	git checkout {tagname}-branch
Include the fix manually if it's just a change ....
	git add .
	git ci -m "Fix included" # or cherry-pick the commit, whatever is easier
	git cherry-pick {num_commit}
@RadwaKamal
RadwaKamal / change_convention.py
Created March 17, 2016 11:51
A simple python script to convert naming convention from lower camel case to snake case in a file.
#!/usr/bin/env python
#Simple python script to change lower camel case strings in a file to snake case
import sys
import re
#detect if the string is lower camel case
def is_camel(word):
bol = re.search('\w([a-z][A-Z])', word)
return bol
@robertmarsal
robertmarsal / gist:9feaa9150926efa4175a
Created December 17, 2014 21:09
Install f.lux on Ubuntu 14.10
sudo apt-get install python-glade2 python-appindicator
git clone https://github.com/Kilian/f.lux-indicator-applet.git
cd f.lux-indicator-applet
chmod +x setup.py
sudo ./setup.py install
fluxgui
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote