This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
# Set the class as TEST_RUNNER in settings.py | |
TEST_RUNNER = 'app.test.TestRunner' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Use as `"#fff".parseColor()` | |
*/ | |
fun String.parseColor() = Color.parseColor(this) | |
/** | |
* Use as `16.spToPx(context)` or `16.5.spToPx(context)` | |
*/ | |
fun Number.spToPx(context: Context) = TypedValue.applyDimension( | |
TypedValue.COMPLEX_UNIT_SP, this.toFloat(), context.resources.displayMetrics).toInt() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.AdapterView; | |
/** | |
* Used this to differentiate between user selected and prorammatically selected | |
* Call {@link Spinner#programmaticallySetPosition} to use this feature. | |
* Created by vedant on 6/1/15. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.os.Build; | |
import android.text.SpannableStringBuilder; | |
import android.text.method.LinkMovementMethod; | |
import android.text.style.ClickableSpan; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewTreeObserver; | |
import android.widget.TextView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had to change this in the telegram CLI to make it work: | |
https://github.com/vedant1811/tg/commit/e068c2549f2f155ba9c40bd7cee8b076d03b417f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste this in linkedin my connections to toggle all "remove connection" menu and auto accept the confirmation dialog | |
Array.from(document.querySelectorAll(".mn-connection-card__dropdown-trigger")).forEach(button=>button.click()) | |
window.setInterval(function(){ | |
document.querySelectorAll('[data-control-name="confirm_removed"]')[0].click() | |
}, 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git ls-files | xargs wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten_array(array) | |
ans = [] | |
array&.each do |element| | |
if element.is_a? Array | |
ans += flatten_array(element) | |
else | |
ans << element | |
end | |
end | |
ans |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/22933955 | |
git config --global push.default current | |
https://stackoverflow.com/a/22147540 | |
git config --global branch.autosetuprebase always | |
git config --global branch.autosetupmerge always | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://rubular.com/r/RQobzZSU9KPSYI | |
usernames = /^[a-zA-Z]+[a-zA-Z0-9_.-]*$/ |
NewerOlder