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
// 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_.-]*$/ |
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) | |
result = [] | |
array.each do |e| | |
if e.is_a? Array | |
result += flatten_array e | |
else | |
result << e | |
end | |
end | |
result |
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
default: &default | |
adapter: postgresql | |
encoding: unicode | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
timeout: 5000 | |
host: localhost | |
username: rails | |
password: rails | |
development: |
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 catch(arr, k) | |
ps = 0 | |
ts = 0 | |
count = 0 | |
arr.each do |e| | |
if e == 'T' | |
if ps > 0 | |
ps -= 1 | |
count += 1 |
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 balance(string) | |
offset = 0 | |
swaps = 0 | |
string.each_char do |c| | |
if c == '[' | |
if offset > 0 | |
swaps += offset | |
end | |
offset -= 1 | |
else |
NewerOlder